Answer the question
In order to leave comments, you need to log in
How to parse the number of results from a Google search using PHP
I need to read the number of results that Google will display for a certain word. So you need to do this many times (let's drive in about 5k words and count the number of results)
I tried to google google search api - I didn’t really understand anything, I didn’t find instructions on how to work with it. I'm newbie, worked mostly with PHP only.
Please tell me how can I do this...
Answer the question
In order to leave comments, you need to log in
Open google. Do a couple of requests. Look at the changes in the url, on the basis of which you draw conclusions about how the url is formed.
Next, you form a list of urls for all the necessary requests, go through these urls, use regular expressions to extract the number of results from the given data (displayed under the search form).
All this is implemented using standard PHP tools.
If necessary, you can complicate and improve the algorithm ad infinitum.
The point is that when the code is executed:
function grab($site){
$data = file_get_contents($site);
echo $data;
if ($data) return $data; else return FALSE;
Is it really worth reinventing the wheel?
http://stackoverflow.com/questions/4082966/google-web-search-api-deprecated-what-now
It says how to tie Google Custom Search engine to global search
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question