大佬教程收集整理的这篇文章主要介绍了php – LinkedIn REST API – 内部服务器错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
PHP:
$posttitle = "Hello"; $postDesc = "world "; $submitted-url = "http://example.com"; $submitted-image-url = "http://images.example.com/img/Hello.jpg"; $comment = "foobar"; $postData = array('visibility' => array('code' => 'connections-only'),'content' => array('title' => $posttitle,'description' => $postDesc,'submitted-url' => $postuRL,'submitted-image-url' => $postImagE),'comment' => $postComment); $ch = curl_init('https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$oauthToken.'&format=json' ); curl_setopt_array($ch,array( CURLOPT_POST => TRUE,CURLOPT_RETURNTRANSFER => TRUE,CURLOPT_httpHEADER => array('x-li-format: json',"Content-Type: application/json"),CURLOPT_POSTFIELDS => json_encode($postData) )); $response = curl_exec($ch);
$posttitle = "Hello"; $postDesc = "world "; $postuRL = "http://example.com"; $postImage = "http://images.example.com/img/Hello.jpg"; $postComment = "foobar"; $oauthToken = "<token>"; $postData = array( 'visibility' => array('code' => 'connections-only'),'content' => array( 'title' => $posttitle,'submitted-image-url' => $postImage ),'comment' => $postComment ); $ch = curl_init('https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$oauthToken.'&format=json'); curl_setopt_array($ch,array( CURLOPT_POST => TRUE,CURLOPT_POSTFIELDS => json_encode($postData) )); $response = curl_exec($ch);
仅当$oauthToken设置为有效令牌时才有效.假设您的真实代码是正确的,剩下的唯一可能性是您的OAuth令牌已过期,您需要先获取新的令牌.通过添加CURLOPT_VERBOSE =>对于cURL选项,您可以找到有关LinkedIn返回的错误的更多信息.
以上是大佬教程为你收集整理的php – LinkedIn REST API – 内部服务器错误全部内容,希望文章能够帮你解决php – LinkedIn REST API – 内部服务器错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。