duandingqi9442 2011-06-14 08:29
浏览 65

有关Curl Method的Google OpenSocial API问题

I am trying to build an application using Google Opensocial API. But when i make a POST request with following CURL headers, i am getting 405 Method not allowed error :

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
        )

Following is the CURL-POST response I am recieving :

["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

I asked about this issue on Google Codes forum and they told me to remove following line from CURL request as my website is hosted on hostgator.

CURLOPT_CUSTOMREQUEST : POST

I tried above thing but still i am getting 405 Method not allowed error. Kindly assist me further on this issue. Do i need to modify my PHP-CURL code above to send POST request? If so, then please help me..

  • 写回答

1条回答 默认 最新

  • douliang1369 2011-06-14 10:11
    关注

    The Google Social specification has an example in which people.get is requested with GET, not via POST. Generally keep in mind that GET is for requesting information, while POST is for changing existing information.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向