XMLHttpRequest
in package
implements
XMLHttpRequest
Browser-style HTTP client abstraction over cURL.
Included for historical compatibility only. This API is out of support and should not be used in new code.
Example:
$req = new XMLHttpRequest();
$req->open($method, $uri);
$req->send($data);
$req->responseText;
Tags
Table of Contents
Interfaces
- XMLHttpRequest
Constants
- NEWLINE : mixed = "\n"
Properties
- $connectTimeout : int
- $cookies : array<string|int, mixed>
- $followRedirects : int
- $globalDNS : int
- $httpVersion : int
- $keepAliveActive : int
- $keepAliveInterval : int
- $keepAliveTimeout : int
- $maxRedirects : int
- $readyState : int
- $response : mixed
- $responseText : string|null
- $responseType : string
- $responseXML : DOMDocument|null
- $status : int
- $statusText : string
- $timeout : int
- $transferTimeout : int
- $upload : XMLHttpRequestEventTarget|null
- $useCookies : bool
- $withCredentials : bool
- $_env : array<string|int, mixed>
- $_responseCharset : string|null
- $_responseType : string|null
- $async : bool
- $cookieFile : string
- $eventListeners : array<string|int, mixed>
- $method : string
- $password : string|null
- $requestHeaders : array<string|int, mixed>
- $responseHead : string
- $responseHeaders : array<string|int, mixed>
- $ssl : bool
- $url : string
- $urlParam : array<string|int, mixed>
- $user : string|null
- $utf8BOM : string
Methods
- __construct() : mixed
- abort() : void
- addEventListener() : void
- dispatchEvent() : bool
- getAllResponseHeaders() : array<string|int, mixed>
- getCookieFile() : string
- getRequestHeader() : mixed
- getResponseHeader() : string
- open() : void
- overrideMimeType() : void
- parseHeaderList() : mixed
- removeEventListener() : void
- send() : void
- setCookie() : mixed
- setCookieFile() : void
- setRequestHeader() : void
- addCookie() : mixed
- fireEventListener() : mixed
Constants
NEWLINE
public
mixed
NEWLINE
= "\n"
Properties
$connectTimeout
public
int
$connectTimeout
= 300
$cookies
public
static array<string|int, mixed>
$cookies
= array()
$followRedirects
public
int
$followRedirects
= 1
$globalDNS
public
int
$globalDNS
= 0
$httpVersion
public
int
$httpVersion
= CURL_HTTP_VERSION_1_1
$keepAliveActive
public
int
$keepAliveActive
= 1
$keepAliveInterval
public
int
$keepAliveInterval
= 10
$keepAliveTimeout
public
int
$keepAliveTimeout
= 10
$maxRedirects
public
int
$maxRedirects
= 10
$readyState
public
int
$readyState
= self::UNSENT
$response
public
mixed
$response
= null
$responseText
public
string|null
$responseText
= null
$responseType
public
string
$responseType
$responseXML
public
DOMDocument|null
$responseXML
= null
$status
public
int
$status
= 0
$statusText
public
string
$statusText
= ''
$timeout
public
int
$timeout
= 0
$transferTimeout
public
int
$transferTimeout
= \Slothsoft\Core\Calendar\Seconds::HOUR
$upload
public
XMLHttpRequestEventTarget|null
$upload
$useCookies
public
static bool
$useCookies
= false
$withCredentials
public
bool
$withCredentials
$_env
protected
array<string|int, mixed>
$_env
= ['SERVER_NAME' => 'localhost', 'SERVER_SOFTWARE' => 'PHP']
$_responseCharset
protected
string|null
$_responseCharset
= null
$_responseType
protected
string|null
$_responseType
= null
$async
protected
bool
$async
$cookieFile
protected
string
$cookieFile
= ''
$eventListeners
protected
array<string|int, mixed>
$eventListeners
$method
protected
string
$method
$password
protected
string|null
$password
$requestHeaders
protected
array<string|int, mixed>
$requestHeaders
$responseHead
protected
string
$responseHead
$responseHeaders
protected
array<string|int, mixed>
$responseHeaders
$ssl
protected
bool
$ssl
$url
protected
string
$url
$urlParam
protected
array<string|int, mixed>
$urlParam
$user
protected
string|null
$user
$utf8BOM
protected
string
$utf8BOM
Methods
__construct()
public
__construct() : mixed
abort()
public
abort() : void
addEventListener()
public
addEventListener(string $type, callable $listener[, bool $capture = false ]) : void
Parameters
- $type : string
- $listener : callable
- $capture : bool = false
dispatchEvent()
public
dispatchEvent(mixed $event) : bool
Parameters
- $event : mixed
Return values
boolgetAllResponseHeaders()
public
getAllResponseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getCookieFile()
public
getCookieFile() : string
Return values
stringgetRequestHeader()
public
getRequestHeader(mixed $header) : mixed
Parameters
- $header : mixed
getResponseHeader()
public
getResponseHeader(string $header) : string
Parameters
- $header : string
Return values
stringopen()
public
open(string $method, string $url[, bool $async = true ][, string|null $user = null ][, string|null $password = null ]) : void
Parameters
- $method : string
- $url : string
- $async : bool = true
- $user : string|null = null
- $password : string|null = null
overrideMimeType()
public
overrideMimeType(string $mime) : void
Parameters
- $mime : string
parseHeaderList()
public
static parseHeaderList(mixed $head) : mixed
Parameters
- $head : mixed
removeEventListener()
public
removeEventListener(string $type, callable $listener[, bool $capture = false ]) : void
Parameters
- $type : string
- $listener : callable
- $capture : bool = false
send()
public
send([mixed $data = null ]) : void
Parameters
- $data : mixed = null
setCookie()
public
static setCookie(mixed $key, mixed $val) : mixed
Parameters
- $key : mixed
- $val : mixed
setCookieFile()
public
setCookieFile(string $file) : void
Parameters
- $file : string
setRequestHeader()
public
setRequestHeader(string $header, string $value) : void
Parameters
- $header : string
- $value : string
addCookie()
protected
static addCookie(mixed $line) : mixed
Parameters
- $line : mixed
fireEventListener()
protected
fireEventListener(mixed $type) : mixed
Parameters
- $type : mixed