Basic Authentication provider

Provides a handler for Basic HTTP authentication via the Authorization header.

package Requests
subpackage Authentication

 Methods

Constructor

__construct(array|null $args = null

Parameters

$args

arraynull

Array of user and password. Must have exactly two elements

Exceptions

\Requests_Exception On incorrect number of arguments (`authbasicbadargs`)

Set cURL parameters before the data is sent

curl_before_send(resource $handle) 

Parameters

$handle

resource

cURL resource

Add extra headers to the request before sending

fsockopen_header(string $out) 

Parameters

$out

string

HTTP header string

Get the authentication string (user:pass)

getAuthString() : string

Returns

string

Register the necessary callbacks

register(\Requests_Hooks $hooks) 

This method is called in \Requests::request when the user has set an instance as the 'auth' option. Use this callback to register all the hooks you'll need.

see
see
inherited_from \Requests_Auth::register()

Parameters

$hooks

\Requests_Hooks

Hook system

 Properties

 

Password

$pass : string

Default

 

Username

$user : string

Default