Client
class Client
Client simulates a browser.
To make the actual request, you need to implement the doRequest() method.
If you want to be able to run requests in their own process (insulated flag), you need to also implement the getScript() method.
Methods
Constructor.
Sets whether to automatically follow redirects or not.
Returns whether client automatically follows redirects or not.
Sets the maximum number of requests that crawler can follow.
Returns the maximum number of requests that crawler can follow.
Sets the insulated flag.
Sets server parameters.
Sets single server parameter.
Gets single server parameter for specified key.
Returns the History instance.
Returns the CookieJar instance.
Returns the current Crawler instance.
Returns the current BrowserKit Response instance.
Returns the current origin response instance.
Returns the current BrowserKit Request instance.
Returns the current origin Request instance.
Calls a URI.
Follow redirects?
Restarts the client.
Details
at line line 54
__construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
Constructor.
at line line 66
followRedirects(bool $followRedirect = true)
Sets whether to automatically follow redirects or not.
at line line 76
bool
isFollowingRedirects()
Returns whether client automatically follows redirects or not.
at line line 86
setMaxRedirects(int $maxRedirects)
Sets the maximum number of requests that crawler can follow.
at line line 97
int
getMaxRedirects()
Returns the maximum number of requests that crawler can follow.
at line line 109
insulate(bool $insulated = true)
Sets the insulated flag.
at line line 123
setServerParameters(array $server)
Sets server parameters.
at line line 137
setServerParameter(string $key, string $value)
Sets single server parameter.
at line line 150
string
getServerParameter(string $key, string $default = '')
Gets single server parameter for specified key.
at line line 160
History
getHistory()
Returns the History instance.
at line line 170
CookieJar
getCookieJar()
Returns the CookieJar instance.
at line line 180
Crawler|null
getCrawler()
Returns the current Crawler instance.
at line line 190
Response|null
getInternalResponse()
Returns the current BrowserKit Response instance.
at line line 205
object|null
getResponse()
Returns the current origin response instance.
The origin response is the response instance that is returned by the code that handles requests.
at line line 215
Request|null
getInternalRequest()
Returns the current BrowserKit Request instance.
at line line 230
object|null
getRequest()
Returns the current origin Request instance.
The origin request is the request instance that is sent to the code that handles requests.
at line line 279
Crawler
request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
Calls a URI.
at line line 433
Crawler
back()
Goes back in the browser history.
at line line 443
Crawler
forward()
Goes forward in the browser history.
at line line 453
Crawler
reload()
Reloads the current browser.
at line line 465
Crawler
followRedirect()
Follow redirects?
at line line 513
restart()
Restarts the client.
It flushes history and all cookies.