Which API can fetch the Google search position for any input URL?

40 views Asked by At

I am writing a component in php, so that the user can input any keyword in a field, any URL in another field, after submitted it should return the google ranking of that website.

E.g: 1st search - keyword: "Black Friday", url: "amazon.com" 2nd search - keyword: "Black Friday", url: "bestbuy.com".

I know web scraping could be one method but that's not ideal as it is against Google's T&C.

I have been checking both Google Customer Search Console API, Google Ads API, and Google Analytics API but none of them seems to be able to give me the required information.

The closest possible, is to use the Custom Search JSON API as follow, which allows me to get some result for a keyword with specific requirements like country, lang etc: https://customsearch.googleapis.com/customsearch/v1?cx=CUSTOME_ENGINE_ID&q=Black%20Friday&key=YOUR_API_KEY

After receiving the JSON, the possible way was to look for the inquired url in the data. However, the returned data from the JSON is completely different from what I search on Google, so the search position wouldn't make sense.

If I use the Analytics API, I would only be able to receive the data from the domains which the API account have access to.

There are some 3rd party serp api which could achieve what I need, just want to try my best on the Google's one first.

0

There are 0 answers