Answer the question
In order to leave comments, you need to log in
How to parse number of pages in search.aol.com?
I'm trying to determine the number of pages of the site through search.aol.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://search.aol.com/aol/search?s_chn=prt_btest1-g&q=site%3Ahttps%3A%2F%2Ftoster.ru&s_it=comsearch");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://search.aol.com/");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$strg=curl_exec($ch);
curl_close($ch);
echo $strg;
preg_match("/<div id=\"result-count\">About(.*)results<\/div>/s", $strg,$find);
if(preg_match("/Your search returned no results./s", $strg)){$resg=0;} else {$resg=trim($find['1']);}
echo $resg;
Answer the question
In order to leave comments, you need to log in
So there is a difference between a request from a browser and a request from curl, so it’s time for you to master the debugger too, in this case a sniffer, there are quite a few of them - Fiddler, Wireshark, Charles, etc., my advice to you, do not evade this , do not run away from problems, but solve them, otherwise you will remain blind, a programmer without a debugger is blind!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question