TwitterOAuth\Auth\AuthAbstract::get PHP Метод

get() публичный Метод

Send a GET call to Twitter API via OAuth
public get ( string $call, array $getParams = null ) : mixed
$call string Twitter resource string
$getParams array GET parameters to send
Результат mixed Output with selected format
    public function get($call, array $getParams = null)
    {
        $this->resetCallState();
        $this->call = $call;
        $this->method = 'GET';
        if ($getParams !== null && is_array($getParams)) {
            $this->getParams = $getParams;
        }
        $response = $this->getResponse();
        $response['body'] = $this->findExceptions($response);
        $this->headers = $response['headers'];
        unset($call, $getParams);
        return $this->serializer->format($response['body']);
    }

Usage Example

Пример #1
0
 /**
  * @param $keyword
  * @param $param
  *
  * @return TwitterSearchResult
  */
 private function search($keyword, $param)
 {
     $params = ['q' => $keyword, 'count' => self::COUNT, 'lang' => self::LANG, 'result_type' => 'recent', 'include_entities' => 'false'];
     $params = array_merge($params, $param);
     $res = new TwitterSearchResult($this->twitterOAuth->get('search/tweets', $params));
     $res->meta->max_id = $res->search_metadata->max_id_str;
     parse_str(trim($res->search_metadata->next_results, '?'), $next);
     $res->meta->next_id = isset($next['max_id']) ? $next['max_id'] : null;
     return $res;
 }