1
votes

How i can start to use API SearchConsole (Server to Server Applications)?

I read: https://developers.google.com/identity/protocols/OAuth2ServiceAccount I not know how make SHA256withRSA in PHP -

Sign the UTF-8 representation of the input using SHA256withRSA (also known as RSASSA-PKCS1-V1_5-SIGN with the SHA-256 hash function)

Yet i read (use Google API Client Libraries): 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);

get Error - Class 'Google_Service_SearchConsole' not found:

1

1 Answers

0
votes

You need to add:

use Google_Service_SearchConsole;

at the top of your php file or class.

You might be looking for:

$searchConsole = new Google_Service_Webmasters($client);

though.