I am trying to use Google Webmaster Tools API in PHP :) I have managed to make functions for creating the site in my account.. but now I am trying to get Verification working...
Here is the Doc: http://code.google.com/intl/hr-HR/apis/webmastertools/docs/2.0/developers_guide_protocol.html#AD_Verifying
So the problem is... In the docs says: Then submit an authenticated PUT request to: https://www.google.com/webmasters/tools/feeds/sites/http%3A%2F%2Fwww%2Eexample%2Ecom%2F/
But everything I have tried doesn't work... for example..
$method = strtoupper('put');
$opts = array('http' =>
array(
'method' => $method,
'protocol_version' => 1.0,
'header' => 'Content-type: application/atom+xml'."
Authorization: GoogleLogin auth=".$auth."
Content-Length: ".strlen($content),
'content' => $content
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
Anyone has some ideas how to make verification working? :)
$method = strtoupper($method);
$opts = array('http' =>
array(
'method' => $method,
'protocol_version' => 1.0,
'header' => 'Content-type: ' . $contentType .
(isset($this->auth) && isset($this->auth['Auth']) ? "
Authorization: GoogleLogin auth=" . $this->auth['Auth'] : '' ) .
"
Content-Length: " . strlen($content),
'content' => $content
)
);
$context = stream_context_create($opts);
**$result = @file_get_contents($url, false, $context);**
return $result;