October\Rain\Network\Http

Overview

Http Network Access is used as a cURL wrapper for the HTTP protocol

Implements
  • Stringable

Public Properties

public string $url

url is the HTTP address to use

public string $method

method the request should use

public array $headers

headers to be sent with the request

public callable $headerCallbackFunc

headerCallbackFunc is a custom function for handling response headers

public string $body

body is the last response body

public string $rawBody

rawBody is the last response body (without headers extracted)

public array $code

code is the last returned HTTP code

public array $info

info is the cURL response information

public array $requestOptions

requestOptions contains cURL Options

public array $requestData

public array $requestHeaders

public string $argumentSeparator

public string $streamFile

streamFile is the file to use when writing to a file

public string $streamFilter

streamFilter is the filter to apply when writing response to a file

public int $maxRedirects

maxRedirects allowed

Protected Properties

protected int $redirectCount

redirectCount is an internal counter

protected bool $hasFileData

hasFileData determines if files are being sent with the request


Public Methods

public __toString()

public __toString(): string 

Handy if this object is called directly.

public auth()

public auth(
    string $user,
    string $pass = null
): October\Rain\Network\Http 

auth adds authentication to the request

public data()

public data($key, $value = null): October\Rain\Network\Http 

data added to the request

public dataFile()

public dataFile($key, $filePath): October\Rain\Network\Http 

dataFile added to the request

public static delete()

public static delete(string $url, array $options = null): self 

delete makes a HTTP DELETE call

public static get()

public static get(string $url, array $options = null): self 

get makes a HTTP GET call

public getRequestData()

public getRequestData(): void

getRequestData returns the request data set

public header()

public header(string $value, $value = null): October\Rain\Network\Http 

header added to the request

public headerCallback()

public headerCallback($callback): October\Rain\Network\Http 

headerCallback sets a custom method for handling headers

function header_callback($curl, string $headerLine) {}

public static make()

public static make(
    string $url,
    string $method,
    callable $options = null
): October\Rain\Network\Http 

make the object with common properties

public noRedirect()

public noRedirect(): October\Rain\Network\Http 

noRedirect disables follow location (redirects)

public static options()

public static options(
    string $url,
    array $options = null
): October\Rain\Network\Http 

options makes a HTTP OPTIONS call

public static patch()

public static patch(string $url, array $options = null): self 

patch makes a HTTP PATCH call

public static post()

public static post(string $url, array $options = null): self 

post makes a HTTP POST call

public proxy()

public proxy(
    $type,
    $host,
    $port,
    $username = null,
    $password = null
): October\Rain\Network\Http 

proxy to use with this request

public static put()

public static put(
    string $url,
    array $options = null
): October\Rain\Network\Http 

put makes a HTTP PUT call

public send()

public send(): October\Rain\Network\Http 

send the HTTP request

public setOption()

public setOption(
    string $option,
    string $value = null
): October\Rain\Network\Http 

setOption as a single option to the request

public timeout()

public timeout(string $timeout): October\Rain\Network\Http 

timeout for the request

public toFile()

public toFile(
    string $path,
    string $filter = null
): October\Rain\Network\Http 

toFile write the response to a file

public verifySSL()

public verifySSL(): October\Rain\Network\Http 

verifySSL enabled for the request

Protected Methods

protected headerToArray()

protected headerToArray($header): array 

headerToArray turns a header string into an array