You are here

protected function gapi::httpRequest in Google Analytics Statistics 7.x

Same name and namespace in other branches
  1. 7 includes/gapi.class.php \gapi::httpRequest()

Perform http request

Parameters

Array $get_variables:

Array $post_variables:

Array $headers:

3 calls to gapi::httpRequest()
gapi::authenticateUser in inc/gapi.class.php
Authenticate Google Account with Google
gapi::requestAccountData in inc/gapi.class.php
Request account data from Google Analytics
gapi::requestReportData in inc/gapi.class.php
Request report data from Google Analytics

File

inc/gapi.class.php, line 442

Class

gapi
GAPI - Google Analytics PHP Interface

Code

protected function httpRequest($url, $get_variables = null, $post_variables = null, $headers = null) {
  $interface = gapi::http_interface;
  if (gapi::http_interface == 'auto') {
    if (function_exists('curl_exec')) {
      $interface = 'curl';
    }
    else {
      $interface = 'fopen';
    }
  }
  if ($interface == 'curl') {
    return $this
      ->curlRequest($url, $get_variables, $post_variables, $headers);
  }
  elseif ($interface == 'fopen') {
    return $this
      ->fopenRequest($url, $get_variables, $post_variables, $headers);
  }
  else {
    throw new Exception('Invalid http interface defined. No such interface "' . gapi::http_interface . '"');
  }
}