Help!php Posted March 26, 2012 Share Posted March 26, 2012 I am trying to get content from a website but it doesnt seem to be working. It creates a table and the columns needed but after that the code is not reading. <div style="padding-top: 10px; float: left; clear: both;"> <a style="color: Blue; text-decoration: underline;" href="index.aspx"> Index </a> </div> This is the part thats on the site and I just want to get the href bit "index.aspx". 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 SITEMAPP (url) VALUES( '$url' )"; //echo $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 />"; } This is the for loop statement which should work. But not working. any idea why??? Link to comment https://forums.phpfreaks.com/topic/259736-file_get_content/ Share on other sites More sharing options...
AbraCadaver Posted March 26, 2012 Share Posted March 26, 2012 error_reporting(E_ALL); ini_set('display_errors', '1'); Link to comment https://forums.phpfreaks.com/topic/259736-file_get_content/#findComment-1331330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.