Overview

Namespaces

  • ApiAxle
    • Api
    • Shared
  • ApiAxleTest
    • Api
    • Shared
  • PHP

Classes

  • Config
  • HttpRequest
  • ItemList
  • Utilities

Exceptions

  • ApiException
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo

Class HttpRequest

HttpRequest class provides a very simple wrapper for using cURL functions.

Provides a single static function to make an HTTP request and get the results. If there is an error returned from the server it will throw an \ErrorException with the error message and error number returned from curl_exec.

Namespace: ApiAxle\Shared
Author: Phillip Shipley <phillip@phillipshipley.com>
Located at src/ApiAxle/Shared/HttpRequest.php
Methods summary
public static string
# request( string $uri, string $method = 'GET', string|array $postfields = false, mixed $headers = false, mixed $config = false )

Make an HTTP Request

Make an HTTP Request

Simplified interface to cURL methods.

Parameters

$uri
string
$uri The URI to make the request to. For GET requests it should include all parameters. This is passed as the CURLOPT_URL
$method
string
$method Set to either GET (default) or POST
$postfields
string|array
$postfields If using POST, this parameter will be set as CURLOPT_POSTFIELDS
$headers
$config

Returns

string
On successful HTTP request, it will return the body of the response as a string.

Throws

ErrorException
On error making the HTTP request.

Link

http://php.net/curl
fillup/apiaxle API documentation generated by ApiGen 2.8.0