Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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']);
 }
Ejemplo n.º 4
0
 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']));
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 public function getUserInfo()
 {
     if (!$this->token instanceof Access) {
         throw new Exception('Token must be an instance of Access');
     }
     // Create a new GET request with the required parameters
     $request = new Resource('GET', 'https://api.twitter.com/1.1/account/verify_credentials.json', 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' => $user->id, 'nickname' => $user->screen_name, 'name' => $user->name ? $user->name : $user->screen_name, 'location' => $user->location, 'image' => $user->profile_image_url, 'description' => $user->description, 'urls' => array('Website' => $user->url, 'Twitter' => 'http://twitter.com/' . $user->screen_name));
 }
Ejemplo n.º 7
0
 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();
 }