Hey, I want to make script that search on source code .. for example if I set to find 'search' on google.com it will show FOUND. Anyone know this kind of script ? Thank you
You need to follow these steps. [1] Scrape the contents of the given url See How to scrap links on a web page using PHP [2] Use stristr command in php to find the string you want. See following example. $a = "i am a string and someone wants to search 'to be searched' "; $targetstring = "to be searched"; if(stristr($a, $targetstring) === TRUE) { echo "string found" ; } PHP:
Thank you for your reply, This is my code for now : <?php $homepage = file_get_contents('http://google.com/'); $homepage = htmlspecialchars($homepage); $targetstring = "x"; if (stristr($homepage, $targetstring) === FALSE) echo "Not Found !"; else echo "Found !"; ?> Code (markup): Very simple... How can I make it (this code) connect to website from Proxy or fake my user agent to the User IP wont be banned ?, the script will refresh itself every minute. (I dont store the content of the page - its an online check) Kindly try to help. Thank you in advance.
When I read your last post, I had a thought that you are trying to scrap web pages from a PC. Is that so? In that case, you would have written a small program in C# to do all that. Even in this case, if Internet Explorer can browse web pages correctly, then you don't need to do any proxy settings on the program. Since you mentioned "script" in your first post, I thought you are looking for a code that runs on a webserver. No need to consider proxy settings in this case at all. However, it seems that you are running the script in a local web server, is that right? In this case, check whether your web browser can view web pages and the local web server is configured to allow Internet access.