Jump to content

The page cannot be displayed


Help!php

Recommended Posts

Sorry..

 

Well I am trying to read a sitemap and get the URL and the page is not displaying. But I managed to change one of the name to true and its printing what I echoed but no result.

 

$_ECHO = TRUE;

 

This was false before.

 

Now that I have changed it to true.. It prints START: Fetching site map.. then it goes straight to NO URL FOUND ON THIS PAGE. its skipping the middle bits. any help???

 

 

 

$numSitemapPages = 1;	
$html = new simple_html_dom();

if($_ECHO) echo "START: Fetching site map...<br />";

for( $i = 0; $i < $numSitemapPages; $i++ )
{
	if($_ECHO) echo "Page $i<br />";

	$fileContents = file_get_contents( "http://www.website.co.uk/SiteMap" . $i . ".aspx" );
	$html->load( $fileContents );

	$hrefs = $html->find( "a(style=color: Blue; text-decoration: underline;)" );

	if ( isset( $hrefs[ 0 ] ) )
	{
		foreach( $hrefs as $href )
		{						
			$url = "http://www.website.co.uk/" . $href->href;
			$qry = "INSERT INTO SITEMAP (url) VALUES( '$url' )";

			mysql_query( $qry, $con );

			if($_ECHO) echo "MYSQL: Added $href->href to DB<br />";
		}
	}
	else
		if($_ECHO) echo "NO URLS FOUND ON THIS PAGE!<br />";
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.