Get the URLs from the Google search result page

0

Hello,

I would like some API or any way to get the URLs that Google returns when it searches.

For example, I did a Google search with cURL looking for Walmarts, I would like PHP to return all the URLs of the sites. I did not find any such method on the web, could you help me?

Thank you in advance.

    
asked by anonymous 06.09.2016 / 04:16

1 answer

3

Google has a service for this:

  • " link ?"
  • "q=" + search (example "Star + Wars")
  • "& cx=" + code from your CSE (Custom Search Engine)
  • "& key=" + Key of your API [Create an API project, then go to 'APIs & auth 'and enable' Custom Search API ']

And then you'll have something like this:

https://www.googleapis.com/customsearch/v1?q=Star+Wars&cx=018475493028468909364:ldifwlodnso&key=AOgsDiRlzY7GDCKC5Th7yKutv-7Hd4-IDehl_Sp

You'll get the results all in JSON

    
06.09.2016 / 15:09