Moodle  2.2.1
http://www.collinsharper.com
SimpleUserAgent Class Reference

Public Member Functions

 SimpleUserAgent ()
 restart ($date=false)
 addHeader ($header)
 ageCookies ($interval)
 setCookie ($name, $value, $host=false, $path= '/', $expiry=false)
 getCookieValue ($host, $path, $name)
 getBaseCookieValue ($name, $base)
 ignoreCookies ()
 useCookies ()
 setConnectionTimeout ($timeout)
 setMaximumRedirects ($max)
 useProxy ($proxy, $username, $password)
 _isTooManyRedirects ($redirects)
 setIdentity ($host, $realm, $username, $password)
fetchResponse ($url, $encoding)
_fetchWhileRedirected ($url, $encoding)
_fetch ($url, $encoding)
_createRequest ($url, $encoding)
_createHttpRequest ($url, $encoding)
_createRoute ($url)
 _addAdditionalHeaders (&$request)

Data Fields

 $_cookie_jar
 $_cookies_enabled = true
 $_authenticator
 $_max_redirects = DEFAULT_MAX_REDIRECTS
 $_proxy = false
 $_proxy_username = false
 $_proxy_password = false
 $_connection_timeout = DEFAULT_CONNECTION_TIMEOUT
 $_additional_headers = array()

Detailed Description

Definition at line 31 of file user_agent.php.


Member Function Documentation

_addAdditionalHeaders ( &$  request)

Adds additional manual headers.

Parameters:
SimpleHttpRequest$requestOutgoing request. private

Definition at line 326 of file user_agent.php.

Here is the caller graph for this function:

& _createHttpRequest ( url,
encoding 
)

Builds the appropriate HTTP request object.

Parameters:
SimpleUrl$urlTarget to fetch as url object.
SimpleFormEncoding$parametersPOST/GET parameters.
Returns:
SimpleHttpRequest New request object. protected

Definition at line 297 of file user_agent.php.

Here is the call graph for this function:

Here is the caller graph for this function:

& _createRequest ( url,
encoding 
)

Creates a full page request.

Parameters:
SimpleUrl$urlTarget to fetch as url object.
SimpleFormEncoding$encodingPOST/GET parameters.
Returns:
SimpleHttpRequest New request. private

Definition at line 280 of file user_agent.php.

Here is the call graph for this function:

Here is the caller graph for this function:

& _createRoute ( url)

Sets up either a direct route or via a proxy.

Parameters:
SimpleUrl$urlTarget to fetch as url object.
Returns:
SimpleRoute Route to take to fetch URL. protected

Definition at line 308 of file user_agent.php.

Here is the caller graph for this function:

& _fetch ( url,
encoding 
)

Actually make the web request.

Parameters:
SimpleUrl$urlTarget to fetch.
SimpleFormEncoding$encodingAdditional parameters for request.
Returns:
SimpleHttpResponse Headers and hopefully content. protected

Definition at line 267 of file user_agent.php.

Here is the call graph for this function:

Here is the caller graph for this function:

& _fetchWhileRedirected ( url,
encoding 
)

Fetches the page until no longer redirected or until the redirect limit runs out.

Parameters:
SimpleUrl$urlTarget to fetch.
SimpelFormEncoding$encodingAdditional parameters for request.
Returns:
SimpleHttpResponse Hopefully the target page. private

Definition at line 239 of file user_agent.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_isTooManyRedirects ( redirects)

Test to see if the redirect limit is passed.

Parameters:
integer$redirectsCount so far.
Returns:
boolean True if over. private

Definition at line 190 of file user_agent.php.

Here is the caller graph for this function:

addHeader ( header)

Adds a header to every fetch.

Parameters:
string$headerHeader line to add to every request until cleared. public

Definition at line 71 of file user_agent.php.

ageCookies ( interval)

Ages the cookies by the specified time.

Parameters:
integer$intervalAmount in seconds. public

Definition at line 80 of file user_agent.php.

& fetchResponse ( url,
encoding 
)

Fetches a URL as a response object. Will keep trying if redirected. It will also collect authentication realm information.

Parameters:
string/SimpleUrl$url Target to fetch.
SimpleEncoding$encodingAdditional parameters for request.
Returns:
SimpleHttpResponse Hopefully the target page. public

Definition at line 214 of file user_agent.php.

Here is the call graph for this function:

getBaseCookieValue ( name,
base 
)

Reads the current cookies within the base URL.

Parameters:
string$nameKey of cookie to find.
SimpleUrl$baseBase URL to search from.
Returns:
string/boolean Null if there is no base URL, false if the cookie is not set. public

Definition at line 120 of file user_agent.php.

Here is the call graph for this function:

getCookieValue ( host,
path,
name 
)

Reads the most specific cookie value from the browser cookies.

Parameters:
string$hostHost to search.
string$pathApplicable path.
string$nameName of cookie to read.
Returns:
string False if not present, else the value as a string. public

Definition at line 108 of file user_agent.php.

Here is the caller graph for this function:

Switches off cookie sending and recieving. public

Definition at line 131 of file user_agent.php.

restart ( date = false)

Removes expired and temporary cookies as if the browser was closed and re-opened. Authorisation has to be obtained again as well.

Parameters:
string/integer$date Time when session restarted. If omitted then all persistent cookies are kept. public

Definition at line 60 of file user_agent.php.

setConnectionTimeout ( timeout)

Sets the socket timeout for opening a connection.

Parameters:
integer$timeoutMaximum time in seconds. public

Definition at line 148 of file user_agent.php.

setCookie ( name,
value,
host = false,
path = '/',
expiry = false 
)

Sets an additional cookie. If a cookie has the same name and path it is replaced.

Parameters:
string$nameCookie key.
string$valueValue of cookie.
string$hostHost upon which the cookie is valid.
string$pathCookie path if not host wide.
string$expiryExpiry date. public

Definition at line 94 of file user_agent.php.

setIdentity ( host,
realm,
username,
password 
)

Sets the identity for the current realm.

Parameters:
string$hostHost to which realm applies.
string$realmFull name of realm.
string$usernameUsername for realm.
string$passwordPassword for realm. public

Definition at line 202 of file user_agent.php.

setMaximumRedirects ( max)

Sets the maximum number of redirects before a page will be loaded anyway.

Parameters:
integer$maxMost hops allowed. public

Definition at line 158 of file user_agent.php.

Starts with no cookies, realms or proxies. public

Definition at line 46 of file user_agent.php.

Switches back on the cookie sending and recieving. public

Definition at line 139 of file user_agent.php.

useProxy ( proxy,
username,
password 
)

Sets proxy to use on all requests for when testing from behind a firewall. Set URL to false to disable.

Parameters:
string$proxyProxy URL.
string$usernameProxy username for authentication.
string$passwordProxy password for authentication. public

Definition at line 171 of file user_agent.php.


Field Documentation

$_additional_headers = array()

Definition at line 40 of file user_agent.php.

$_authenticator

Definition at line 34 of file user_agent.php.

$_connection_timeout = DEFAULT_CONNECTION_TIMEOUT

Definition at line 39 of file user_agent.php.

$_cookie_jar

Definition at line 32 of file user_agent.php.

$_cookies_enabled = true

Definition at line 33 of file user_agent.php.

$_max_redirects = DEFAULT_MAX_REDIRECTS

Definition at line 35 of file user_agent.php.

$_proxy = false

Definition at line 36 of file user_agent.php.

$_proxy_password = false

Definition at line 38 of file user_agent.php.

$_proxy_username = false

Definition at line 37 of file user_agent.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations