Example #1
0
 /**
  * Execute an HTTP API request call and returns data
  *
  * @param string $method  HTTP method type (get, post, ...)
  * @param string $url     API called URL
  * @param array  $options Optionals method parameters
  *
  * @return \stdClass
  *
  * @throws \RuntimeException When Instagram application (client) is not set
  */
 public function executeRequest($method, $url, array $options = array())
 {
     if (null === $this->application) {
         throw new \RuntimeException('You must set Application before using an endpoint API method.');
     }
     $token = $this->application->getAccessToken();
     $url = sprintf($url . '?access_token=%s', $token);
     $url .= '&' . http_build_query($options);
     $response = $this->client->get($url)->send();
     $data = json_decode($response->getBody(true));
     return $data;
 }