Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.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 403-“;拒绝访问过帐股份”的链接;_Php_Json_Linkedin_Http Status Code 403_Linkedin Api - Fatal编程技术网

Php LinkedIn API 403-“;拒绝访问过帐股份”的链接;

Php LinkedIn API 403-“;拒绝访问过帐股份”的链接;,php,json,linkedin,http-status-code-403,linkedin-api,Php,Json,Linkedin,Http Status Code 403,Linkedin Api,我正在开发一个PHP函数,在我公司的框架下,自动共享Linkedin用户提要上的新文章。身份验证起作用,因此令牌也起作用(我可以在共享文章时从LinkedIn获得我的名字和姓氏),但在共享文章时,我在帖子结果中不断收到一个403错误“拒绝访问发布共享” 在我的应用程序中,参数“r_basicprofile”和“w_share”被选中。但是,当我创建授权URL(我正在使用它进行连接)时,我重新添加了这些范围参数。我还以用户身份连接,在我的LinkedIn应用程序上拥有管理员和开发者权限。但我仍然无

我正在开发一个PHP函数,在我公司的框架下,自动共享Linkedin用户提要上的新文章。身份验证起作用,因此令牌也起作用(我可以在共享文章时从LinkedIn获得我的名字和姓氏),但在共享文章时,我在帖子结果中不断收到一个403错误“拒绝访问发布共享”

在我的应用程序中,参数“r_basicprofile”和“w_share”被选中。但是,当我创建授权URL(我正在使用它进行连接)时,我重新添加了这些范围参数。我还以用户身份连接,在我的LinkedIn应用程序上拥有管理员和开发者权限。但我仍然无法在自己的提要上共享文章

下面是我代码中失败的部分。我使用的是AJAX,因此如果我将生成的URL记录在console.log中,它是有效的,但会以JSON格式返回403错误消息

/* Create API request to share an article */

//Building up the URL
$url = 'https://api.linkedin.com/v1/people/~/shares?&oauth2_access_token='.$_SESSION['linkedInCreds']['access_token'].'&format=json&message='.rawurlencode($_REQUEST['message']).'&visibility[code]='.$_REQUEST['visibility']['code'];
    $options = array(
        'http' => array(
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
            'method'  => 'POST',
            'content' => http_build_query($url)
        )
    );


$context = stream_context_create($options);
$result = file_get_contents($url, false, $context); /***** FAILS: Returns JSON with 403 error code from LinkedIn. *****/

/* Check if $result is true or false and echoes the result. End of AJAX. */
我现在被这个问题困扰着。显然这个功能并没有被LinkedIn删除,但我无法让它工作,有人能帮忙吗

提前感谢。

不久前(去年),他们取消了使用API执行某些操作的功能。老实说,几乎使他们的API完全无用。如果没有一些“特殊”的访问权限,你就无法真正访问个人资料信息、工作经历等,而这些权限似乎并不容易发布。我不确定您的数据是否属于他们删除API功能的类别,但如果不向他们申请特殊许可,很可能无法实现,我认为他们不会授予很多人。