duanben1909 2013-03-02 01:04
浏览 55
已采纳

在LinkedIN OAuth中获得403 [关闭]

I am getting this error

Invalid auth/bad request (got a 403, expected HTTP/1.1 20X or a redirect) at this line
$data = $oauthc->fetch($url, $body, $method, $headers);

while I use this code

try {
            $oauthc = new \OAuth(CUSTOMER_KEY, CUSTOMER_SECRET,
                OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
            $oauthc->enableDebug();
            $oauthc->setNonce(rand());

            $url = 'https://api.linkedin.com/v1/jobs';
            $body = file_get_contents('http://azaidi-usweb-08.vps.zulily.com/job.xml');
            $method = OAUTH_HTTP_METHOD_POST;
            $headers = array('Content-Type' => 'text/xml');

            $data = $oauthc->fetch($url, $body, $method, $headers);


            $response = $oauthc->getLastResponse();
            $response_info = $oauthc->getLastResponseInfo();

            print "<pre>";
            print_r($oauthc->debugInfo);
            print_r($response);
            print_r($response_info);
            print "</pre>";

            exit;
}catch(OAuthException $e) {
    print_r($oauthc->debugInfo);
    print_r($e);
    exit;
}

Any help will be appreciated

  • 写回答

1条回答 默认 最新

  • doushan3511 2013-03-10 07:06
    关注

    Before going deeper into this... the Jobs posting API program is only for selected partners. Has your company been accepted into this program? If not, you will not be able to post jobs regardless of whether we solve this issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?