|
Moodle
2.2.1
http://www.collinsharper.com
|
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() | |
Definition at line 31 of file user_agent.php.
| _addAdditionalHeaders | ( | &$ | request | ) |
Adds additional manual headers.
| SimpleHttpRequest | $request | Outgoing request. private |
Definition at line 326 of file user_agent.php.

| & _createHttpRequest | ( | $ | url, |
| $ | encoding | ||
| ) |
Builds the appropriate HTTP request object.
| SimpleUrl | $url | Target to fetch as url object. |
| SimpleFormEncoding | $parameters | POST/GET parameters. |
Definition at line 297 of file user_agent.php.


| & _createRequest | ( | $ | url, |
| $ | encoding | ||
| ) |
Creates a full page request.
| SimpleUrl | $url | Target to fetch as url object. |
| SimpleFormEncoding | $encoding | POST/GET parameters. |
Definition at line 280 of file user_agent.php.


| & _createRoute | ( | $ | url | ) |
Sets up either a direct route or via a proxy.
| SimpleUrl | $url | Target to fetch as url object. |
Definition at line 308 of file user_agent.php.

| & _fetch | ( | $ | url, |
| $ | encoding | ||
| ) |
Actually make the web request.
| SimpleUrl | $url | Target to fetch. |
| SimpleFormEncoding | $encoding | Additional parameters for request. |
Definition at line 267 of file user_agent.php.


| & _fetchWhileRedirected | ( | $ | url, |
| $ | encoding | ||
| ) |
Fetches the page until no longer redirected or until the redirect limit runs out.
| SimpleUrl | $url | Target to fetch. |
| SimpelFormEncoding | $encoding | Additional parameters for request. |
Definition at line 239 of file user_agent.php.


| _isTooManyRedirects | ( | $ | redirects | ) |
Test to see if the redirect limit is passed.
| integer | $redirects | Count so far. |
Definition at line 190 of file user_agent.php.

| addHeader | ( | $ | header | ) |
Adds a header to every fetch.
| string | $header | Header 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.
| integer | $interval | Amount 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.
| string/SimpleUrl | $url Target to fetch. | |
| SimpleEncoding | $encoding | Additional parameters for request. |
Definition at line 214 of file user_agent.php.

| getBaseCookieValue | ( | $ | name, |
| $ | base | ||
| ) |
Reads the current cookies within the base URL.
| string | $name | Key of cookie to find. |
| SimpleUrl | $base | Base URL to search from. |
Definition at line 120 of file user_agent.php.

| getCookieValue | ( | $ | host, |
| $ | path, | ||
| $ | name | ||
| ) |
Reads the most specific cookie value from the browser cookies.
| string | $host | Host to search. |
| string | $path | Applicable path. |
| string | $name | Name of cookie to read. |
Definition at line 108 of file user_agent.php.

| ignoreCookies | ( | ) |
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.
| 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.
| integer | $timeout | Maximum 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.
| 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. public |
Definition at line 94 of file user_agent.php.
| setIdentity | ( | $ | host, |
| $ | realm, | ||
| $ | username, | ||
| $ | password | ||
| ) |
Sets the identity for the current realm.
| string | $host | Host to which realm applies. |
| string | $realm | Full name of realm. |
| string | $username | Username for realm. |
| string | $password | Password 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.
| integer | $max | Most hops allowed. public |
Definition at line 158 of file user_agent.php.
| SimpleUserAgent | ( | ) |
Starts with no cookies, realms or proxies. public
Definition at line 46 of file user_agent.php.
| useCookies | ( | ) |
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.
| string | $proxy | Proxy URL. |
| string | $username | Proxy username for authentication. |
| string | $password | Proxy password for authentication. public |
Definition at line 171 of file user_agent.php.
| $_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.