[英]Including Google Sitemap Api in PHP with OAuth2.0
While integrating Google Sitemap API in PHP I am logged in with Google OAuth2.0 (works like charm), but this code does not fit :在 PHP 中集成 Google Sitemap API 时,我使用 Google OAuth2.0 登录(就像魅力一样),但这段代码不适合:
$key = 'SOME-GOOGLE-KEY';
$obj = json_decode(file_get_contents("https://www.googleapis.com/webmasters/v3/sites?key=$key"), true);
print_r($obj);
Error-message:错误信息:
failed to open stream: HTTP request failed!
无法打开流:HTTP 请求失败! HTTP/1.0 401 Unauthorized
HTTP/1.0 401 未经授权
The API-key is correct and has no restrictions. API 密钥是正确的,没有任何限制。 It's bound to "Google Search Console API".
它绑定到“Google Search Console API”。 The "Google Search Console API" is activated also.
“Google Search Console API”也被激活。
How to authorize correctly?如何正确授权?
At least i found a solution called: google-api-php-client which is hosted at GitHub:至少我找到了一个名为:google-api-php-client 的解决方案,它托管在 GitHub 上:
https://github.com/googleapis/google-api-php-client https://github.com/googleapis/google-api-php-client
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.