You are here

public function TwitterAPIExchange::request in Twitter Profile Widget 8.2

Same name and namespace in other branches
  1. 8 src/Resources/j7mbo/twitter_api_php/TwitterAPIExchange.php \Drupal\twitter_profile_widget\Resources\j7mbo\twitter_api_php\TwitterAPIExchange::request()

Helper method to perform our request

Parameters

string $url:

string $method:

string $data:

array $curlOptions:

Return value

string The json response from the server

Throws

\Exception

File

src/Resources/j7mbo/twitter_api_php/TwitterAPIExchange.php, line 381

Class

TwitterAPIExchange
Twitter-API-PHP : Simple PHP wrapper for the v1.1 API

Namespace

Drupal\twitter_profile_widget\Resources\j7mbo\twitter_api_php

Code

public function request($url, $method = 'get', $data = null, $curlOptions = []) {
  if (strtolower($method) === 'get') {
    $this
      ->setGetfield($data);
  }
  else {
    $this
      ->setPostfields($data);
  }
  return $this
    ->buildOauth($url, $method)
    ->performRequest(true, $curlOptions);
}