简体   繁体   中英

Get number of search results using one of the big search engine APIs

i am searching for a way to retrieve the number of search results (like on google result pages) for a given query. the aim is to implementent the normalized google distance (http://iknowate.blogspot.com/2011/10/google-similarity-distance.html) using a search api; the main problem is that the number of requests shouldnt be too limited (google api seems to allow only ~100 queries / day).

maybe someone could give me a hint how i could retrieve this information.

You could either use a third party library/class to scrape the results page and then traverse the DOM to get your info or use file_get_contents to get the page and then use preg_match to get the total number of results. Another option would be to scrape the page using CURL which would also enable you to hide your script behind multiple Agents to prevent any kind of bans if you intend to scrape pages multiple times.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM