我正在將linkedin訪問令牌存儲在數據庫中。這是存儲在我的數據庫中的令牌:Linkedin:如何使用訪問令牌進行api調用?
oauth_token=xxxxxxxxxxxxxxxxxxx&oauth_token_secret=xxxxxxxxxxxxxxxxxxx&oauth_expires_in=5183998&oauth_authorization_expires_in=5183998
我想使用此訪問令牌檢索linkedin連接。我試圖撥打電話這樣的:
$a = new Zend_Oauth_Token_Access();
$client = $a->getHttpClient(array(
'siteUrl' => LIN_SITE_URL,
'callbackUrl' => LIN_SITE_CALLBACK_URL,
'requestTokenUrl' => LIN_REQUEST_TOKEN_URL,
'userAuthorizationUrl' => LIN_USER_AUTHORIZATION_URL,
'accessTokenUrl' => LIN_ACCESS_TOKEN_URL,
'consumerKey' => LIN_CONSUMER_KEY,
'consumerSecret' => LIN_CONSUMER_SECRET
));
$client->setUri('http://api.linkedin.com/v1/people/~/connections:(id,first-name,last-name,picture-url)');
$client->setParameterGet('token',$linToken);
$client->setMethod(Zend_Http_Client::GET);
$response = $client->request();
$content = $response->getBody();
$data = json_decode(Zend_Json::fromXml($content, false));
print_r($data); echo "<br/>";
我在這裏得到的錯誤是:
stdClass Object ([error] => stdClass Object ([status] => 404 [timestamp] => 1349429996351 [request-id] => 8U8A1UNF1V [error-code] => 0 [message] => Could not find person based on: ~))
這是撥打電話的正確方法還是我在這裏做了什麼。我正在使用zend框架。
謝謝。
在db中,我存儲整個字符串,我作爲訪問令牌取回。下面是我回來以下: 的oauth_token = xxxxxxxxxxxxxxxxxxx&oauth_token_secret = xxxxxxxxxxxxxxxxxxx&oauth_expires_in = 5183998&oauth_authorization_expires_in = 5183998 我訪問上面的分貝。我沒有在任何地方設置令牌和密碼。我想知道如果它正確的方式來存儲訪問令牌的數據庫。別人如何存儲?我應該將oauth_token和oauth_token_secret分別存儲在數據庫中嗎? – VishwaKumar