Requests 2.0.0 API

Basic implements Auth

Basic Authentication provider

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

Interfaces, Classes and Traits

Auth
Authentication provider interface

Table of Contents

$pass  : string
Password
$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
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).

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

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

Return values
mixed

getAuthString()

Get the authentication string (user:pass)

public getAuthString() : string
Return values
string

Search results