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 />";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.