public function oAuthRequestPostXml($url) { if ($this->getParameters()) { $parameters = $this->getParameters(); } else { $parameters = null; } $consumer = $this->getConsumer(); $accessToken = $this->getConsumer($this->getAccessToken(), $this->getAccessTokenSecret(), $this->getCallbackUrl()); $req = BuddyStreamOAuthRequest::from_consumer_and_token($consumer, $accessToken, 'POST', $url, $this->getParameters()); $req->sign_request(new BuddyStreamOAuthSignatureMethod_HMAC_SHA1(), $consumer, $accessToken); $ci = curl_init(); curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ci, CURLOPT_URL, $url); curl_setopt($ci, CURLOPT_VERBOSE, FALSE); $header = array($req->to_header('http://api.linkedin.com')); $header[] = 'Content-Type: text/xml; charset=UTF-8'; curl_setopt($ci, CURLOPT_POSTFIELDS, $this->getPostData()); curl_setopt($ci, CURLOPT_HTTPHEADER, $header); $response = curl_exec($ci); curl_close($ci); return $response; }
function oAuthRequest($url) { if ($this->getParameters()) { $parameters = $this->getParameters(); } else { $parameters = null; } $consumer = $this->getConsumer(); $accessToken = $this->getConsumer($this->getAccessToken(), $this->getAccessTokenSecret(), $this->getCallbackUrl()); $req = BuddyStreamOAuthRequest::from_consumer_and_token($consumer, $accessToken, $this->getRequestType(), $url, $parameters); $req->sign_request(new BuddyStreamOAuthSignatureMethod_HMAC_SHA1(), $consumer, $accessToken); if ($this->getRequestType() == 'GET') { return $this->executeRequest($req->to_url()); } else { $this->setPostData($req->to_postdata()); return $this->executeRequest($req->get_normalized_http_url()); } }