2017-02-21 115 views
1

我如何开始使用API​​ SearchConsole(服务器到服务器应用程序)?我如何开始使用API​​ SearchConsole(服务器到服务器应用程序)?

我读: https://developers.google.com/identity/protocols/OAuth2ServiceAccount 我不知道如何在PHP做SHA256withRSA -

注册使用SHA256withRSA(也 称为RSASSA-PKCS1-v1_5中-SIGN与输入的UTF-8表示SHA-256散列函数)

但我读(使用谷歌API客户端库): https://developers.google.com/api-client-library/php/auth/service-accounts

$json_file = __DIR__.'/OAuth2-0-ec587a9ccbc0.json'; 

putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/'.$json_file); 

$client = new Google_Client(); 
$client->useApplicationDefaultCredentials(); 

$admin = new Google_Service_SearchConsole($client); 

得到Error - Class 'Google_Service_SearchConsole' not found:

回答

0

您需要添加:

use Google_Service_SearchConsole;

在你的PHP文件或类的顶部。虽然

$searchConsole = new Google_Service_Webmasters($client);

你可能会寻找。

相关问题