Example #1
0
 /**
  * @param $url
  * @param array $params
  * @param string $method
  * @param null $callback
  * @param bool $multipart
  * @return array|OAuthResponse
  */
 private function OAuthRequest($url, $params = [], $method = 'GET', $callback = null, $multipart = false)
 {
     $oauth = new OAuthRequest($this->consumer_key, $this->consumer_secret, $this->access_token, $this->access_token_secret);
     $oauth->setUserAgent('ttools ' . self::VERSION . ' - github.com/ttools/ttools');
     $response = $oauth->request($method, $url, $params, $multipart);
     if (!$response) {
         return ['error' => "666"];
     }
     $this->last_req_info = ['path' => $url, 'response_code' => $response->getCode()];
     if ($callback !== null) {
         call_user_func($callback, $response->getCode(), $response->getResponse());
     }
     return $response;
 }