myanavrin Posted August 15, 2007 Share Posted August 15, 2007 Hello to all, I want to read the page source of web page. Ex. http://www.phpfreaks.com I want to search for a string in its page source. THanks Link to comment https://forums.phpfreaks.com/topic/65082-php-code-to-read-a-web-pages-source/ Share on other sites More sharing options...
php_tom Posted August 15, 2007 Share Posted August 15, 2007 <?php $f = file_get_contents("http://www.phpfreaks.com"); // Now $f is a string with the whole webpage source in it (line breaks and all). if(strstr($f, "forums")) echo "Forums"; else echo "No forums"; ?> Hope that helps. Link to comment https://forums.phpfreaks.com/topic/65082-php-code-to-read-a-web-pages-source/#findComment-324814 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.