这是我的代码:
$url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=XXXXXXX';
$url .= '&format=json';
$postdata = http_build_query(
array(
'comment' => 'comment',
'content' => array('title' => 'LInkedIN title',
'description' => 'linkedin desc',
'submitted-url' => "https://developer.linkedin.com",
),
'visibility' => array('code' => 'anyone')
)
);
$opts = array('http' =>
array('method' => 'POST',
'header'=> "x-li-format : json\r\n".
"Host: api.linkedin.com\r\n".
"Content-Length: ".strlen($postdata)."\r\n".
"X-Target-URI: https://api.linkedin.com\r\n".
"Content-Type: application/json\r\n".
"Connection: Keep-Alive",
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
但没有效果。试过这项服务https://apigee.com/console/linkedin - 完美地运作......
出了什么问题?
答案 0 :(得分:0)
http://datopstech.com/linkedin-share-tool/
和源代码:
https://github.com/kaburkett/LinkedIn-Advanced-Share
如果可以的话,请将您的项目作为基础。