dongzhi4498 2019-07-30 19:36 采纳率: 100%
浏览 132

使用Google API凭据时,Google页面速​​度洞察API需要验证码

I'm attempting to hit the PageSpeed Insights API as documented here https://developers.google.com/speed/docs/insights/v5/about with PHP and curl and am getting in return a response that looks like this:

{
   'captchaResult' => "CAPTCHA_NEEDED"
}

My code to query the API looks like this:

$url = 'https://google.com';
$cmd = "curl -H 'Cache-Control: no-cache' https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=$url&key={MY_KEY}";
$result = json_decode(`$cmd`, true);

The documentation states "If you plan on using the API in an automated way and making multiple queries per second, you'll need an API key". I've created an API key in the developer's console, but am still getting the above result.

Ideally, I'd like to be able to make short bursts of 10-20 requests per second.

I have two questions:

  1. Is there any documentation available for rate limiting in the PageSpeed Insights API?

  2. How do I satisfy the CAPTCHA_NEEDED requirement for this API?

  • 写回答

0条回答 默认 最新

    报告相同问题?