Requests 2.0.0 API

Http
in package
implements Proxy

HTTP Proxy connection interface

Provides a handler for connection via an HTTP proxy

Tags
since
1.6

Interfaces, Classes and Traits

Proxy
Proxy connection interface

Table of Contents

$pass  : string
Password
$proxy  : string
Proxy host and port
$use_authentication  : bool
Do we need to authenticate? (ie username & password have been provided)
$user  : string
Username
__construct()  : mixed
Constructor
curl_before_send()  : mixed
Set cURL parameters before the data is sent
fsockopen_header()  : mixed
Add extra headers to the request before sending
fsockopen_remote_host_path()  : mixed
Alter remote path before getting stream data
fsockopen_remote_socket()  : mixed
Alter remote socket information before opening socket connection
get_auth_string()  : string
Get the authentication string (user:pass)
register()  : mixed
Register the necessary callbacks

Properties

$pass

Password

public string $pass

$proxy

Proxy host and port

public string $proxy

Notation: "host:port" (eg 127.0.0.1:8080 or someproxy.com:3128)

$use_authentication

Do we need to authenticate? (ie username & password have been provided)

public bool $use_authentication

$user

Username

public string $user

Methods

__construct()

Constructor

public __construct([array<string|int, mixed>|string|null $args = null ]) : mixed
Parameters
$args : array<string|int, mixed>|string|null = null

Proxy as a string or an array of proxy, user and password. When passed as an array, must have exactly one (proxy) or three elements (proxy, user, password).

Tags
since
1.6
throws
InvalidArgument

When the passed argument is not an array, a string or null.

throws
ArgumentCount

On incorrect number of arguments (proxyhttpbadargs)

Return values
mixed

curl_before_send()

Set cURL parameters before the data is sent

public curl_before_send(resource|CurlHandle &$handle) : mixed
Parameters
$handle : resource|CurlHandle

cURL handle

Tags
since
1.6
Return values
mixed

fsockopen_header()

Add extra headers to the request before sending

public fsockopen_header(string &$out) : mixed
Parameters
$out : string

HTTP header string

Tags
since
1.6
Return values
mixed

fsockopen_remote_host_path()

Alter remote path before getting stream data

public fsockopen_remote_host_path(string &$path, string $url) : mixed
Parameters
$path : string

Path to send in HTTP request string ("GET ...")

$url : string

Full URL we're requesting

Tags
since
1.6
Return values
mixed

fsockopen_remote_socket()

Alter remote socket information before opening socket connection

public fsockopen_remote_socket(string &$remote_socket) : mixed
Parameters
$remote_socket : string

Socket connection string

Tags
since
1.6
Return values
mixed

get_auth_string()

Get the authentication string (user:pass)

public get_auth_string() : string
Tags
since
1.6
Return values
string

register()

Register the necessary callbacks

public register(Hooks $hooks) : mixed
Parameters
$hooks : Hooks

Hook system

Tags
since
1.6
see
HTTP::curl_before_send()
see
HTTP::fsockopen_remote_socket()
see
HTTP::fsockopen_remote_host_path()
see
HTTP::fsockopen_header()
Return values
mixed

Search results