Requests 2.0.14 API

Basic implements Auth

Basic Authentication provider

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

Table of Contents

Interfaces

Auth
Authentication provider interface

Properties

$pass  : string
Password
$user  : string
Username

Methods

__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
getAuthString()  : string
Get the authentication string (user:pass)
register()  : mixed
Register the necessary callbacks

Properties

$pass

Password

public string $pass

$user

Username

public string $user

Methods

__construct()

Constructor

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

Array of user and password. Must have exactly two elements

Tags
since
2.0

Throws an InvalidArgument exception.

since
2.0

Throws an ArgumentCount exception instead of the Requests base `Exception.

throws
InvalidArgument

When the passed argument is not an array or null.

throws
ArgumentCount

On incorrect number of array elements (authbasicbadargs).

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

fsockopen_header()

Add extra headers to the request before sending

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

HTTP header string

getAuthString()

Get the authentication string (user:pass)

public getAuthString() : string
Return values
string

        
On this page

Search results