Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

CAS_AbstractRequest Class Reference

Inheritance diagram for CAS_AbstractRequest:
CAS_RequestInterface CAS_CurlRequest

List of all members.

Public Member Functions

 setUrl ($url)
 addCookie ($name, $value)
 addCookies (array $cookies)
 addHeader ($header)
 addHeaders (array $headers)
 makePost ()
 setPostBody ($body)
 setSslCaCert ($caCertPath)
 send ()
 getResponseHeaders ()
 getResponseBody ()
 getErrorMessage ()

Protected Member Functions

 _sendRequest ()
 storeResponseHeaders (array $headers)
 storeResponseHeader ($header)
 storeResponseBody ($body)
 storeErrorMessage ($message)

Protected Attributes

 $url = null
 $cookies = array()
 $headers = array()
 $isPost = FALSE
 $postBody = null
 $caCertPath = null

Private Attributes

 $sent = FALSE
 $responseHeaders = array()
 $responseBody = null
 $errorMessage = ''

Detailed Description

Provides support for performing web-requests via curl

Definition at line 36 of file AbstractRequest.php.


Member Function Documentation

CAS_AbstractRequest::_sendRequest (  )  [abstract, protected]

Send the request and store the results.

Returns:
boolean TRUE on success, FALSE on failure.

Referenced by send().

CAS_AbstractRequest::addCookie ( name,
value 
)

Add a cookie to the request.

Parameters:
string $name
string $value
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 77 of file AbstractRequest.php.

CAS_AbstractRequest::addCookies ( array $  cookies  ) 

Add an array of cookies to the request. The cookie array is of the form array('cookie_name' => 'cookie_value', 'cookie_name2' => cookie_value2')

Parameters:
array $cookies
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 93 of file AbstractRequest.php.

CAS_AbstractRequest::addHeader ( header  ) 

Add a header string to the request.

Parameters:
string $header
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 107 of file AbstractRequest.php.

CAS_AbstractRequest::addHeaders ( array $  headers  ) 

Add an array of header strings to the request.

Parameters:
array $headers
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 121 of file AbstractRequest.php.

CAS_AbstractRequest::getErrorMessage (  ) 

Answer a message describing any errors if the request failed.

Returns:
string
Exceptions:
CAS_OutOfSequenceException If called before the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 274 of file AbstractRequest.php.

CAS_AbstractRequest::getResponseBody (  ) 

Answer the body of response.

Returns:
string
Exceptions:
CAS_OutOfSequenceException If called before the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 261 of file AbstractRequest.php.

CAS_AbstractRequest::getResponseHeaders (  ) 

Answer the headers of the response.

Returns:
array An array of header strings.
Exceptions:
CAS_OutOfSequenceException If called before the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 248 of file AbstractRequest.php.

CAS_AbstractRequest::makePost (  ) 

Make the request a POST request rather than the default GET request.

Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 134 of file AbstractRequest.php.

CAS_AbstractRequest::send (  ) 

Perform the request.

Returns:
boolean TRUE on success, FALSE on failure.
Exceptions:
CAS_OutOfSequenceException If called multiple times.

Implements CAS_RequestInterface.

Definition at line 181 of file AbstractRequest.php.

References _sendRequest().

CAS_AbstractRequest::setPostBody ( body  ) 

Add a POST body to the request

Parameters:
string $body
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 148 of file AbstractRequest.php.

CAS_AbstractRequest::setSslCaCert ( caCertPath  ) 

Specify the path to an SSL CA certificate to validate the server with.

Parameters:
string $sslCertPath
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 164 of file AbstractRequest.php.

References $caCertPath.

CAS_AbstractRequest::setUrl ( url  ) 

Set the URL of the Request

Parameters:
string $url
Returns:
void
Exceptions:
CAS_OutOfSequenceException If called after the Request has been sent.

Implements CAS_RequestInterface.

Definition at line 62 of file AbstractRequest.php.

References $url.

CAS_AbstractRequest::storeErrorMessage ( message  )  [protected]

Add a string to our error message.

Parameters:
string $message
Returns:
void

Definition at line 234 of file AbstractRequest.php.

Referenced by CAS_CurlRequest::_sendRequest().

CAS_AbstractRequest::storeResponseBody ( body  )  [protected]

Store the response body.

Parameters:
string $body
Returns:
void

Definition at line 224 of file AbstractRequest.php.

Referenced by CAS_CurlRequest::_sendRequest().

CAS_AbstractRequest::storeResponseHeader ( header  )  [protected]

Store a single response header to our array.

Parameters:
string $header
Returns:
void

Definition at line 214 of file AbstractRequest.php.

Referenced by CAS_CurlRequest::_curlReadHeaders().

CAS_AbstractRequest::storeResponseHeaders ( array $  headers  )  [protected]

Store the response headers.

Parameters:
array $headers
Returns:
void

Definition at line 204 of file AbstractRequest.php.


Member Data Documentation

CAS_AbstractRequest::$caCertPath = null [protected]

Definition at line 45 of file AbstractRequest.php.

Referenced by setSslCaCert().

CAS_AbstractRequest::$cookies = array() [protected]

Definition at line 41 of file AbstractRequest.php.

CAS_AbstractRequest::$errorMessage = '' [private]

Definition at line 49 of file AbstractRequest.php.

CAS_AbstractRequest::$headers = array() [protected]

Definition at line 42 of file AbstractRequest.php.

CAS_AbstractRequest::$isPost = FALSE [protected]

Definition at line 43 of file AbstractRequest.php.

CAS_AbstractRequest::$postBody = null [protected]

Definition at line 44 of file AbstractRequest.php.

CAS_AbstractRequest::$responseBody = null [private]

Definition at line 48 of file AbstractRequest.php.

CAS_AbstractRequest::$responseHeaders = array() [private]

Definition at line 47 of file AbstractRequest.php.

CAS_AbstractRequest::$sent = FALSE [private]

Definition at line 46 of file AbstractRequest.php.

CAS_AbstractRequest::$url = null [protected]

Definition at line 40 of file AbstractRequest.php.

Referenced by setUrl().