Starts with no cookies, realms or proxies.
SimpleUserAgent
SimpleUserAgent
()
Adds a header to every fetch.
void
addHeader
(string $header)
-
string
$header: Header line to add to every request until cleared.
Ages the cookies by the specified time.
void
ageCookies
(integer $interval)
-
integer
$interval: Amount in seconds.
Fetches a URL as a response object. Will keep trying if redirected.
It will also collect authentication realm information.
-
string/SimpleUrl
$url: Target to fetch.
-
SimpleEncoding
$encoding: Additional parameters for request.
Reads the current cookies within the base URL.
string/boolean
getBaseCookieValue
(
string $name,
SimpleUrl $base)
-
string
$name: Key of cookie to find.
-
SimpleUrl
$base: Base URL to search from.
Reads the most specific cookie value from the browser cookies.
string
getCookieValue
(string $host, string $path, string $name)
-
string
$host: Host to search.
-
string
$path: Applicable path.
-
string
$name: Name of cookie to read.
Switches off cookie sending and recieving.
void
ignoreCookies
()
Removes expired and temporary cookies as if the browser was closed and re-opened. Authorisation has to be obtained again as well.
void
restart
([string/integer $date = false])
-
string/integer
$date: Time when session restarted. If omitted then all persistent cookies are kept.
Sets the socket timeout for opening a connection.
void
setConnectionTimeout
(integer $timeout)
-
integer
$timeout: Maximum time in seconds.
Sets an additional cookie. If a cookie has the same name and path it is replaced.
void
setCookie
(string $name, string $value, [string $host = false], [string $path = '/'], [string $expiry = false])
-
string
$name: Cookie key.
-
string
$value: Value of cookie.
-
string
$host: Host upon which the cookie is valid.
-
string
$path: Cookie path if not host wide.
-
string
$expiry: Expiry date.
Sets the identity for the current realm.
void
setIdentity
(string $host, string $realm, string $username, string $password)
-
string
$host: Host to which realm applies.
-
string
$realm: Full name of realm.
-
string
$username: Username for realm.
-
string
$password: Password for realm.
Sets the maximum number of redirects before a page will be loaded anyway.
void
setMaximumRedirects
(integer $max)
-
integer
$max: Most hops allowed.
Switches back on the cookie sending and recieving.
void
useCookies
()
Sets proxy to use on all requests for when testing from behind a firewall. Set URL to false to disable.
void
useProxy
(string $proxy, string $username, string $password)
-
string
$proxy: Proxy URL.
-
string
$username: Proxy username for authentication.
-
string
$password: Proxy password for authentication.
Builds the appropriate HTTP request object.
-
SimpleUrl
$url: Target to fetch as url object.
-
SimpleFormEncoding
$parameters: POST/GET parameters.
-
$encoding
Sets up either a direct route or via a proxy.
-
SimpleUrl
$url: Target to fetch as url object.
Actually make the web request.
-
SimpleUrl
$url: Target to fetch.
-
SimpleFormEncoding
$encoding: Additional parameters for request.