I\'m trying to use curl to detect whether a piece of text exists in the source code of a remote webpage. For example, I\'m trying to see if this string exists in the source:
The two functions you need are cURL and strpos().
cURL
strpos()
<?php $ch = curl_init("http://www.example.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $text = curl_exec($ch); $test = strpos($text, "<!-- BEGIN TEST CODE -->"); if ($test==false) { echo "no"; } else { echo "yes"; } ?>