You are here

public function Github_HttpClient::request in Bibliography Module 7.2

Send a request to the server, receive a response, decode the response and returns an associative array

Parameters

string $path Request API path:

array $parameters Parameters:

string $httpMethod HTTP method to use:

array $options Request options:

Return value

array Data

2 calls to Github_HttpClient::request()
Github_HttpClient::get in modules/CiteProc/Github/HttpClient.php
Send a GET request
Github_HttpClient::post in modules/CiteProc/Github/HttpClient.php
Send a POST request

File

modules/CiteProc/Github/HttpClient.php, line 91

Class

Github_HttpClient
Performs requests on GitHub API. API documentation should be self-explanatory.

Code

public function request($path, array $parameters = array(), $httpMethod = 'GET', array $options = array()) {
  $this
    ->updateHistory();
  $options = array_merge($this->options, $options);

  // create full url
  $url = strtr($options['url'], array(
    ':protocol' => $options['protocol'],
    ':format' => $options['format'],
    ':path' => trim($path, '/'),
  ));

  // get encoded response
  $response = $this
    ->doRequest($url, $parameters, $httpMethod, $options);

  // decode response
  $response = $this
    ->decodeResponse($response, $options);
  return $response;
}