PHP Search for a string in remote webpage -
I am trying to write a script with PHP where it opens a text file / Urls.txt and check each domain for a specific word I'm really new to PHP. Example: See the word "hello" in the following domains list: Domain1.LTD Domain2.LTD Domain3.LTD
and simply domain name + valid / invalid print.
& lt ;? PHP $ link = "http: //yahoo.com"; // How to loop each line to read a file $ linkcontents = file_get_contents ($ link); $ Needle = "hello"; If (SRPO ($ link content, $ needle) == incorrect) {echo "valid"; } Else {echo "invalid"; }? & Gt;
First Because of security file_get_contents ()
This would be a true strip
example:
// If your last code would be (stops ($ linkcontents, $ Needle!) == false) {// See! == echo "valid"; // needle found} and {echo "invalid"; // needle not found}
You can use some regexp
instead of strows
for more complex crawling.
Comments
Post a Comment