I am trying to search a text string in PHP. For this i am loading the complete webpage source into a variable using
$filename = "http://google.com/";
$filehandle = fopen($filename, "rt");
$contents = fread($filehandle, 10000);
Now to read the data inside the span id we have :
<span style="font-size:18px" id="countdown">4d 19h 34m 43s</span>
I have written the peice of code but it is not working for me:
$string = "id\=\"countdown\"";
if(strstr($contents,$string)) {
echo "found it.";
} else {
echo "not found.";
}
i wish to use some operator like (.+) we can use in PERL where if we make a string match with the syntax
~/abc(.+)ghi/
then data between abc,ghi is assigned to variable $1.