/** * Get a hashtag feed (recent media) * @param string $hashtag The hashtag to get * @return object The hastag recent media object */ public function getHashtag($hashtag) { $endpoint = 'https://api.instagram.com/v1/tags/' . $hashtag . '/media/recent'; $params = array('access_token' => $this->key); $result = Helper::curl('GET', $endpoint, $params); $result = json_decode($result); return $result->data; }
/** * Authorize with the api * @return boolean Always returns true at the moment */ public function auth() { // Get the consumer key and secret from options $this->key = get_option('options_facebook_app_id'); $this->secret = get_option('options_facebook_key_secret'); // Here we need to authorize with the api I guess $endpoint = 'https://graph.facebook.com/oauth/access_token'; $params = array('grant_type' => 'client_credentials', 'client_id' => $this->key, 'client_secret' => $this->secret); $token = Helper::curl('GET', $endpoint, $params); $this->accessToken = explode('=', $token)[1]; return true; }