Exemplo n.º 1
0
 /**
  * Makes an HTTP request.
  *
  * @param $url string URL to request
  * @param string $method The request method ('GET', 'POST', 'PUT', 'DELETE', etc)
  * @param null $data Any additional data to include in the payload.
  * @param null $headers Additional headers to send.
  * @param int $timeout The request timeout in milliseconds
  * @return bool|string The response string, or false if there was an error.
  */
 public static function request($url, $method = 'GET', $data = null, $headers = null, $timeout = 3000)
 {
     if (function_exists('curl_init')) {
         return HttpHelper::request_curl($url, $method, $data, $headers, $timeout);
     } else {
         return HttpHelper::request_file_get_contents($url, $method, $data, $headers, $timeout);
     }
 }