我正在尝试使用 Google Opensocial API 构建应用程序。但是,当我使用以下 CURL 标头发出 POST 请求时,我收到 405 Method not allowed 错误:
CURLOPT_URL : http://www.orkut.com/social/rpc/
CURLOPT_POSTFIELDS : [{"method":"people.get","id":"self","params":{"userId":["@me"],"groupId":"@self","fields":["displayName","currentLocation","thumbnailUrl","gender","name"]}},{"method":"people.get","id":"friends","params":{"userId":["@me"],"groupId":"@friends","fields":["displayName","currentLocation","thumbnailUrl","gender","name"],"count":300}}]
CURLOPT_CUSTOMREQUEST : POST
CURLOPT_RETURNTRANSFER : true
CURLOPT_USERAGENT : osapi 1.0
CURLOPT_FOLLOWLOCATION : 1
CURLOPT_SSL_VERIFYPEER : false
CURLOPT_HEADER : true
CURLINFO_HEADER_OUT : true
CURLOPT_HTTPHEADER : Array
(
[0] => Authorization: OAuth oauth_body_hash="A3ZOHT4b3YMOzEfg+2j3v+N302E=", oauth_nonce="6ad533sdfsb9261ssdfsdf29af7d", oauth_version="1.0", oauth_timestamp="1318236734", oauth_consumer_key="www.mydomain.com", oauth_token="1%2FKhAasdfsd8YX2bfsdfsdf6MsdfsfsdfsdfJYyULWUog", oauth_signature_method="HMAC-SHA1", oauth_signature="osdf4pShOsdfsdf88nnpwsdfsdf9g%3D"
[1] => Content-Type: application/json
[2] => Content-Length: 0
[3] => User-Agent: osapi 1.0
)
以下是我收到的 CURL-POST 响应:
["http_code"] => int(405)
["data"] => string(12614)
"HTTP/1.1 405 Method Not Allowed
Content-Type: text/html; charset=UTF-8
Content-Length: 12462
Date: Tue, 14 Jun 2011 08:07:58 GMT
Server: GFE/2.0
我在 Google Codes 论坛上询问了这个问题,他们告诉我从 CURL 请求中删除以下行,因为我的网站托管在 hostgator 上。
CURLOPT_CUSTOMREQUEST : POST
我尝试了上述方法,但仍然收到 405 Method not allowed 错误。请在这个问题上进一步协助我。我需要修改上面的 PHP-CURL 代码来发送 POST 请求吗?如果是这样,那么请帮助我..