[RESOLVED] Help using strpos to find a text data in string from remote html
Hi all i am trying to use strpos( ..) function to find some data in string from a remote page using curl. My curl is working well since i used print $result; and the html page got loaded with in the script . But the scrip never be able to find the "This profile is set to private. " with the following html ( in remote page):
Code:
<span id="ctl00_Main_ctl00_ctrlMessage">This profile is set to private. This user must add you as a friend to see his/her profile.</span>
I be happy if some one tell me what i am doing wrong.Thanks
PHP Code:
curl_setopt($curl, CURLOPT_URL, 'http://www.myspace.com/' . $_POST['url']);
curl_setopt($curl, CURLOPT_POST, 0);
$result = curl_exec($curl);
$headers = curl_getinfo($curl);
if (strpos($result, 'This profile is set to private.'))
{
echo "found";
}
else
{
echo "Not found";
}
part html:
HTML Code:
<span id="ctl00_Main_ctl00_ctrlMessage">This profile is set to private. This user must add you as a friend to see his/her profile.</span>
Re: Help using strpos to find a text data in string from remote html
I fixed it by changing 'This profile is set to private.' to "This profile is set to private." :-)
Re: [RESOLVED] Help using strpos to find a text data in string from remote html
They both look identical to me :confused:
Re: [RESOLVED] Help using strpos to find a text data in string from remote html
I mean i had to add " instead of just ' around the searching string
Re: [RESOLVED] Help using strpos to find a text data in string from remote html
Anyhow, you should be using the strict comparison operator when using strpos:
if (strpos($result, 'This profile is set to private.') !== false)