mercredi 5 août 2015

Google Search console API mistery


i'm trying to solve a mistery :) I'm trying to add a property url to my Google search console using php script through command line. The site seems to be adding correctly, as IU can list it using the list method, but I'm unable to find on which account it's being added :(

Here's the code i'm using to add a site

    $client_email = '12345-blablablabla@developer.gserviceaccount.com';
    $private_key = file_get_contents('mykey.p12');
    $scopes = array('http://ift.tt/13R7CuS');

    $credentials = new Google_Auth_AssertionCredentials(

        $client_email,
        $scopes,
        $private_key
    );
    $client = new Google_Client();
    $client->setAssertionCredentials($credentials);
    if ($client->getAuth()->isAccessTokenExpired()) {
        $client->getAuth()->refreshTokenWithAssertion();
    }
    $webmastersService = new Google_Service_Webmasters($client);
    $webmastersService->sites->add($url);

And if i call the method $webmastersService->sites->listSites()

I'm being returned the property I added just before.

But on which google account is this added ? This is a mystery :)

Thanks for your help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire