0

Does anyone have a working example how to update site ownership with the Google API PHP SDK?

I can connect to the API, get the site details, I tried different ways to call the update method but I don't receive even an error message.

The code is something like this:

$service = new Google_Service_SiteVerification($client);
$siteList = $service->webResource->listWebResource();
$siteArray = array();
foreach ($siteList->getItems() as $siteItem)
{
    array_push($siteArray, $siteItem);
}
$email_address = "new@email.address";
foreach ($siteArray as $site)
    {
        $owners = $site->getOwners();
        array_push($owners, $email_address);
        $site->setOwners($owners);
        $reponse = $service->webResource->update($site->id, $site);
        print_r($reponse);
    }
Szentmarjay Tibor
  • 1,099
  • 1
  • 7
  • 4

1 Answers1

0

OK, I found the answer. The solution is a plus urldecode:

$response = $service->webResource->update(urldecode($site->id), $site);
Szentmarjay Tibor
  • 1,099
  • 1
  • 7
  • 4