コード例 #1
0
ファイル: Vimeo.php プロジェクト: chrisnharvey/oauth1
 public function getUserInfo()
 {
     // Create a new GET request with the required parameters
     $request = new Resource('GET', 'http://vimeo.com/api/rest/v2?format=json&method=vimeo.people.getInfo', array('oauth_consumer_key' => $this->consumer->client_id, 'oauth_token' => $this->token->access_token));
     // Sign the request using the consumer and token
     $request->sign($this->signature, $this->consumer, $this->token);
     $user = json_decode($request->execute());
     // Create a response from the request
     return array('uid' => $this->token->uid, 'name' => $user->display_name, 'location' => $user->location, 'description' => $user->bio);
 }
コード例 #2
0
ファイル: Dropbox.php プロジェクト: chrisnharvey/oauth1
 public function getUserInfo()
 {
     // Create a new GET request with the required parameters
     $request = new Resource('GET', 'https://api.dropbox.com/1/account/info', array('oauth_consumer_key' => $this->consumer->client_id, 'oauth_token' => $this->token->access_token));
     // Sign the request using the consumer and token
     $request->sign($this->signature, $this->consumer, $this->token);
     $user = json_decode($request->execute());
     // Create a response from the request
     return array('uid' => $this->token->uid, 'name' => $user->display_name, 'email' => $user->email, 'location' => $user->country);
 }
コード例 #3
0
ファイル: Flickr.php プロジェクト: chrisnharvey/oauth1
 public function getUserInfo()
 {
     // Create a new GET request with the required parameters
     $request = new Resource('GET', 'http://api.flickr.com/services/rest', array('oauth_consumer_key' => $this->consumer->client_id, 'oauth_token' => $this->token->access_token, 'nojsoncallback' => 1, 'format' => 'json', 'method' => 'flickr.test.login'));
     // Sign the request using the consumer and token
     $request->sign($this->signature, $this->consumer, $this->token);
     $response = json_decode($request->execute(), true);
     // Create a response from the request
     return array('uid' => $response['user']['id'], 'name' => $response['user']['username']['_content'], 'nickname' => $response['user']['username']['_content']);
 }
コード例 #4
0
ファイル: Linkedin.php プロジェクト: chrisnharvey/oauth1
 public function getUserInfo()
 {
     // Create a new GET request with the required parameters
     $url = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url)';
     $request = new Resource('GET', $url, array('oauth_consumer_key' => $this->consumer->client_id, 'oauth_token' => $this->token->access_token));
     // Sign the request using the consumer and token
     $request->sign($this->signature, $this->consumer, $this->token);
     $user = json_decode(json_encode((array) simplexml_load_string($request->execute())), 1);
     // Create a response from the request
     return array('uid' => $user['id'], 'name' => $user['first-name'] . ' ' . $user['last-name'], 'nickname' => end(explode('/', $user['public-profile-url'])), 'description' => $user['headline'], 'location' => isset($user['location']['name']) ? $user['location']['name'] : null, 'urls' => array('Linked In' => $user['public-profile-url']));
 }
コード例 #5
0
ファイル: Tumblr.php プロジェクト: chrisnharvey/oauth1
 public function getUserInfo()
 {
     // Create a new GET request with the required parameters
     $request = new Resource('GET', 'http://api.tumblr.com/v2/user/info', array('oauth_consumer_key' => $this->consumer->client_id, 'oauth_token' => $this->token->access_token));
     // Sign the request using the consumer and token
     $request->sign($this->signature, $this->consumer, $this->token);
     $response = json_decode($request->execute());
     $status = current($response);
     $response = next($response);
     $user = $response->user;
     // Create a response from the request
     return array('uid' => $user->name, 'name' => $user->name, 'likes' => $user->likes, 'following' => $user->following, 'default_post_format' => $user->default_post_format);
 }
コード例 #6
0
ファイル: Provider.php プロジェクト: chrisnharvey/oauth1
 public function call($method = 'GET', $url, array $params = array())
 {
     // Create a new GET request with the required parameters
     $request = new ResourceRequest($method, $url, array_merge(array('oauth_consumer_key' => $this->consumer->client_id, 'oauth_token' => $this->token->access_token), $params));
     // Sign the request using the consumer and token
     $request->sign($this->signature, $this->consumer, $this->token);
     return $request->execute();
 }