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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.