public function getProfileInfo($ricerca) { $URL = 'https://api.twitter.com/1.1/users/show.json'; $METHOD = 'GET'; $getfield = 'screen_name=' . $ricerca; $result = $this->api->setGetfield($getfield)->buildOauth($URL, $METHOD)->performRequest(); $data = json_decode($result, true); $model = new SocialProfileModel(); $model->setData($data); $model->setName($data['name']); $model->setSocial('twitter'); $model->setFollowersCount($data['followers_count']); $model->setUsername($data['screen_name']); $model->setProfilePicture($data['profile_image_url']); return $model; }
public function getProfileInfo($ricerca) { $result = $this->curl_file_get_contents("https://api.instagram.com/v1/users/search?client_id=" . $this->settings['client_id'] . "&q=" . $ricerca); #first result $result = json_decode($result, true); if (count($result['data'] > 0)) { $result = $result['data'][0]; } $second_result = $this->curl_file_get_contents("https://api.instagram.com/v1/users/" . $result['id'] . "?client_id=" . $this->settings['client_id'] . ""); $second_result = json_decode($second_result, true); $data = array_merge($result, $second_result); $model = new SocialProfileModel(); $model->setData($data); $model->setName($data['full_name']); $model->setSocial('instagram'); $model->setFollowersCount($data['data']['counts']['followed_by']); $model->setUsername($data['username']); $model->setProfilePicture($data['profile_picture']); return $model; }