예제 #1
0
 /**
  * Format and sign an OAuth / API request
  */
 function oAuthRequest($url, $method, $parameters) {
     if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
         $url = "{$this->host}{$url}.{$this->format}";
     }
     $request = SloginOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
     $request->sign_request($this->sha1_method, $this->consumer, $this->token);
     switch ($method) {
         case 'GET':
             return $this->http($request->to_url(), 'GET');
         default:
             return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
     }
 }
예제 #2
0
 function search($parameters)
 {
     $search_url = $this->base_url . "/v1/people-search:(people:(id,first-name,last-name,picture-url,site-standard-profile-request,headline),num-results)" . $parameters;
     //$search_url = $this->base_url . "/v1/people-search?keywords=facebook";
     echo "Performing search for: " . $parameters . "<br />";
     echo "Search URL: {$search_url} <br />";
     $request = SloginOAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "GET", $search_url);
     $request->sign_request($this->signature_method, $this->consumer, $this->access_token);
     $auth_header = $request->to_header("https://api.linkedin.com");
     $response = $this->httpRequest($search_url, $auth_header, "GET");
     return $response;
 }