【问题标题】:Internal service error on LinkedIn using the Share API? [closed]使用 Share API 在 LinkedIn 上出现内部服务错误? [关闭]
【发布时间】:2015-01-11 00:15:37
【问题描述】:

尝试通过Share API 发送帖子时,使用如下代码。我得到了

内部服务错误状态500

PHP 代码

$base_url = 'https://api.linkedin.com/v1/people/~/';
$url = $base_url . 'shares';
$xml  = '<share>';
$xml .= '<comment>' . 'test'. '</comment>';
$xml .= '<content>';
$xml .= '<title>' . 'TEST' . '</title>';
$xml .= '<submitted-url>' . 'http://www.google.com' . '</submitted-url>';
$xml .= '<description>' . 'description' . '</description>';
$xml .= '</content>';
$xml .= '<visibility><code>anyone</code></visibility>';
$xml .= '</share>';
$signature = new OAuthSignatureMethod_HMAC_SHA1();
$consumer_key = '';$consumer_secret = '';
$consumer = new OAuthConsumer('my_api_key', 'my_api_secret_key', NULL);
$token = new OAuthConsumer( $oauth['oauth_token'],  $oauth['oauth_token_secret'], 1);
$request = OAuthRequest::from_consumer_and_token($consumer, $token, 'POST', $url, array ());
$request->sign_request($signature, $consumer, $token);
$header = $request->to_header();
$response = _linkedin_http_request($url, $header, $xml);

函数有:

function _linkedin_http_request($url, $header, $body = NULL) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
    curl_setopt($ch, CURLOPT_URL, $url);
    if ($body) {
        curl_setopt($ch, CURLOPT_POST, 1);
        if ($body == 'token_request') {
            curl_setopt($ch, CURLOPT_POSTFIELDS, '');
        }
        else {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array($header, 'Content-Type: text/xml;charset=utf-8'));
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        }
    }

    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}

我得到的错误如下所示。

$response = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
  <status>500</status>
  <timestamp>1411993375587</timestamp>
  <request-id>FYVRCIMJYO</request-id>
  <error-code>0</error-code>
  <message>Internal service error</message>
</error>

Handling Errors & Invalid Tokens 声明这是来自 LinkedIn 的服务器问题。那我是不是应该等一天再检查一下?

【问题讨论】:

  • 这个问题似乎离题了,因为它与编程无关,而只是 LinkedIn API 的问题。
  • 您使用什么语言? Perl? PHP?
  • 回复:重新打开 - 请参阅 Brad Larson's answer

标签: linkedin


【解决方案1】:

我在测试 LinkedIn API 时遇到了同样的问题。尝试使用另一个网站作为

我还使用了“http://www.google.com”并得到 500 内部服务错误。我将其更改为“http://www.yahoo.com”,效果很好。我不知道为什么会这样。

【讨论】:

    猜你喜欢
    • 2019-10-03
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    • 2018-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-18
    相关资源
    最近更新 更多