Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php LinkedIn API POST请求出现错误401_Php_Http_Cakephp_Login - Fatal编程技术网

Php LinkedIn API POST请求出现错误401

Php LinkedIn API POST请求出现错误401,php,http,cakephp,login,Php,Http,Cakephp,Login,当我试图向LinkedIn发布状态更新时,我得到了401个未经授权的错误。我将LinkedIn应用程序中的Live状态更改为Live,但问题仍然存在。我试过了,但还是有错误。。。GET请求(获取用户配置文件数据,…)一切正常 以下是请求数据: POST /v1/people/~/shares HTTP/1.1 Host: api.linkedin.com Connection: close User-Agent: CakePHP content-type: application/x-www-f

当我试图向LinkedIn发布状态更新时,我得到了401个未经授权的错误。我将LinkedIn应用程序中的Live状态更改为Live,但问题仍然存在。我试过了,但还是有错误。。。GET请求(获取用户配置文件数据,…)一切正常

以下是请求数据:

POST /v1/people/~/shares HTTP/1.1
Host: api.linkedin.com
Connection: close
User-Agent: CakePHP
content-type: application/x-www-form-urlencoded
x-li-format: json
Authorization: OAuth oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="2z82i0j5ahjb",oauth_token="2de47758-86e1-4684-afd3-f55a56051d2d",oauth_nonce="03aae214a19e83fe2757e8061a4b1468",oauth_timestamp="1326363432",oauth_signature="WNbKgq1FnkIgIALI%2FMfVnBHLgTg%3D"
Content-Length: 131

{"comment":"I am tesing CakePHP","content":{"title":"","submitted-url":"","submitted-image-url":""},"visibility":{"code":"anyone"}}
以下是响应数据:

HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Date: Thu, 12 Jan 2012 10:17:12 GMT
Vary: *
x-li-format: json
Content-Type: application/json;charset=UTF-8
Content-Length: 230

{
  "errorCode": 0,
  "message": "[unauthorized]. OAU:2z82i0j5ahjb|2de47758-86e1-4684-afd3-f55a56051d2d|*01|*01:1326363432:WNbKgq1FnkIgIALI/MfVnBHLgTg=",
  "requestId": "5XSUW613R2",
  "status": 401,
  "timestamp": 1326363433324
}

有谁能帮我调试一下,解决这个问题吗?谢谢

找到了问题!内容类型必须是application/json,才能工作!我认为x-li-format:json就足够了,但事实并非如此。

发现了问题!内容类型必须是application/json,才能工作!我认为x-li-format:json就足够了,但事实并非如此