Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.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端点的Linkedin HTTP响应不是代码201_Php_Api_Oauth_Linkedin - Fatal编程技术网

Php 来自Linkedin端点的Linkedin HTTP响应不是代码201

Php 来自Linkedin端点的Linkedin HTTP响应不是代码201,php,api,oauth,linkedin,Php,Api,Oauth,Linkedin,我正在尝试进行API调用: LinkedIn返回一个带有错误的数组,我不明白问题出在哪里 几天前,一切都很顺利 array(5) { 'linkedin' => string(5487) "<!-- EF of static content included--> <html> <head> <title>Error</title> <meta http-equiv="content-type" content

我正在尝试进行API调用:

LinkedIn返回一个带有错误的数组,我不明白问题出在哪里

几天前,一切都很顺利

array(5) {
 'linkedin' =>
  string(5487) "<!-- EF of static content included-->
<html>
<head>
  <title>Error</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <style type="text/css">
/* GLOBAL */
body { margin: 0; padding: 0 0 10px 0; background: #FFF; color: #000; font: 82% arial, helvetica, "Nimbus Sans L", sans-serif; text-align: center; min-width: 775px; }
table { font-size: 100%; border: 0; }
th { text-align: left; }
tr.tblhdr { background: #999; }
.helper { font-size: 85%; }
.spacer { clear: both; line-height: 0; height: 0; _font-size: 1px; }
.indent { margin-left: 35px; }
.top { margin-top: 0 !important; }
.bottom { margin-bottom: 0 !important; }
.btn { text-align: center; }
.right { text-align: right; }
.preview { background: #9CF; }
.even, .odd { background: #EEE; }
abbr { text-decoration: none; border: none; font-style: normal; }
sup { font-size: 70%; }
div.skip { position: absolute; left: -999px; width: 990px; }
.dim { color: #999 !important; }
.vmid { vertical-align: middle; }
.vtop { vertical-align: top; }
."...
  'info' =>
  array(26) {
'url' =>
string(52) "https://api.linkedin.com/v1/companies/2414183/shares"
'content_type' =>
string(9) "text/html"
'http_code' =>
int(405)
'header_size' =>
int(439)
'request_size' =>
int(497)
'filetime' =>
int(-1)
'ssl_verify_result' =>
int(0)
'redirect_count' =>
int(0)
'total_time' =>
double(2.5)
'namelookup_time' =>
double(0)
'connect_time' =>
double(0.062)
'pretransfer_time' =>
double(1.265)
'size_upload' =>
double(1328)
'size_download' =>
double(5487)
'speed_download' =>
double(2194)
'speed_upload' =>
double(531)
'download_content_length' =>
double(5487)
'upload_content_length' =>
double(1328)
'starttransfer_time' =>
double(2.265)
'redirect_time' =>
double(0)
'certinfo' =>
array(0) {
}
'primary_ip' =>
string(14) "255.255.255.255"
'primary_port' =>
int(443)
'local_ip' =>
string(13) "255.255.255.255"
'local_port' =>
int(30965)
'redirect_url' =>
string(0) ""
  }
  'oauth' =>
  array(2) {
    'header' =>
    string(329) "Authorization: OAuthrealm="http%3A%2F%2Fapi.linkedin.com",oauth_version="1.0",oauth_nonce="d2475a156755d8f6aece5a783ec4f8bd",oauth_timestamp="1428413208",oauth_consumer_key="xxxxx",oauth_token="xxxxx",oauth_signature_method="HMAC-SHA1",oauth_signature="xxxxxxx"
'string' =>
string(299) "POST&https%3A%2F%2Fapi.linkedin.com%2Fv1%2Fcompanies%2F2414183%2Fshares&oauth_consumer_key%xxxxx%26oauth_nonce%3Dd2475a156755d8f6aece5a783ec4f8bd%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1428413208%26oauth_token%xxxxx%26oauth_version%3D1.0"
  }
  'success' =>
  bool(false)
  'error' =>
  string(54) "HTTP response from LinkedIn end-point was not code 201"
}
二,

尝试添加您的令牌:
如果您使用php,您可以尝试以下方法:在身份验证后获取令牌

我进行了一些调试,并意识到我linkedIn返回html页面404,这可能是API服务器的响应有问题,因为我无法跟踪错误对发送内容类型的依赖性。因为有些帖子发送正确。
<?xml version="1.0" encoding="UTF-8"?>
<share>
<content>
    <title>1 oz Britannia Silver Coin 999</title>
    <submitted-url>http://example.com</submitted-url>
    <submitted-image-url>http://example.com/image.jpg</submitted-image-url>
    <description>Some text</description>
</content>
<comment>Overview of 1 oz Britannia Silver Coin 999</comment>
    <visibility>
        <code>anyone</code>
    </visibility>
</share>
<?xml version="1.0" encoding="UTF-8"?>
<share>
    <content>
        <title>1 oz Canadian Vancouver Olympics Thunderbird Totem $50 Gold Coin 9999</title>
        <submitted-url>http://example.com</submitted-url>
        <submitted-image-url>http://example.com/image.jpg</submitted-image-url>
        <description>Some text</description>
    </content>
    <comment>Overview of 1 oz Canadian Vancouver Olympics Thunderbird Totem $50 Gold Coin 9999</comment>
    <visibility>
        <code>anyone</code>
    </visibility>
    </share>