/** * Requests an access token from Instagram * @return string JSON Response */ public function requestAccessToken() { $url = parent::$_instagramOAuthUrl . self::$_instaTokenUrlPath; $Communicator = new Communicator($url, $this->getPostVars()); $Communicator->query(); return $jsonResponse = $Communicator->getResponse(); }
/** * Given a shorlink, returns the image source url. * @param string $url Instagram Short URL * @return string Image source url */ public static function getImageFromUrl($url) { $params = array('url' => $url); $url = self::$endpointUrl; $communicator = new Communicator($url, $params); $communicator->query(); $response = $communicator->getResponse(); $data = json_decode($response); $imgSrc = $data->link; return $imgSrc; }
/** * Sends the query and returns the result * @param string $reqType Request type to use, for example "GET", "POST" * @return string JSON Response */ public function query($reqType = '', $count = 30) { $url = $this->requestUrl; $Communicator = new Communicator($url, $this->params); if ($reqType != '') { $Communicator->setCustomRequest($reqType); } $Communicator->query(); $json = $Communicator->getResponse(); $this->processResponse($json); $this->responseWalk(); return $this->response; //$json2 = json_encode($this->response); //var_dump($json2);exit; return $json; }