Ok so I would like to parse HTML from a site (any site so I do not know the IDs or anything) and if they have the keyword in their content to return that link. I have used the cURL library to retrieve a site but after trying to parse it I have failed many times.
I am a bit lost so thank you for your time! I just get a blank webpage so clearly it's a mistake.
This is the code I am using with this website as an example
$b = 'http://stackoverflow.com/questions/ask';
$cSession = curl_init();
curl_setopt($cSession,CURLOPT_URL, $b);
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
$result=curl_exec($cSession);
curl_close($cSession);
$dom = new domDocument;
$doc->preserveWhiteSpace = false;
$dom->loadHTML($result);
if (strpos($dom,'HTML') === true) {
echo $b;
strpos()will never return TRUE, therefore your echo statement doesn't get executed.