我正在尝试使用 google-api-php-client 创建一个 Http put 请求。Oauth 工作正常,我可以收到请求,但我只是不知道如何做一个 put。
//While looping over my contacts
$apiClient = new ApiClient();
$apiClient->setAccessToken($this->Auth->user('google_oauth2_token'));
//Getting fresh XML data since I transformed mine into an array
$contactGetRequest = new apiHttpRequest($contact['link'][1]['@href'], 'GET', array('GData-Version' => 3.0));
$rawContactData = $apiClient->getIo()->authenticatedRequest($contactGetRequest);
$contactXml = Xml::build($rawContactData->getResponseBody());
//Not changing anything, just trying to do a PUT request
$contactPutRequest = new apiHttpRequest($contact['link'][2]['@href'], 'PUT', array('GData-Version' => 3.0), $contactXml->asXML());
$response = $apiClient->getIo()->authenticatedRequest($contactPutRequest);
错误是“Content-Type application/x-www-form-urlencoded 不是有效的输入类型。”。
似乎它正在尝试进行 POST。执行 PUT 请求的正确方法是什么?