phpCAS version 1.3.6

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CAS_Request_AbstractRequest Class Reference
Inheritance diagram for CAS_Request_AbstractRequest:

## Public Member Functions
| setUrl ($url)
| addCookie ($name, $value)
| addCookies (array $cookies)
| addHeader ($header)
| addHeaders (array $headers)
| makePost ()
| setPostBody ($body)
| setSslCaCert ($caCertPath, $validate_cn=true)
| send ()
| getResponseHeaders ()
| getResponseStatusCode ()
| getResponseBody ()
| getErrorMessage ()
Public Member Functions inherited from CAS_Request_RequestInterface
| setUrl ($url)
| addCookie ($name, $value)
| addCookies (array $cookies)
| addHeader ($header)
| addHeaders (array $headers)
| makePost ()
| setPostBody ($body)
| setSslCaCert ($caCertPath, $validate_cn=true)
| send ()
| getResponseHeaders ()
| getResponseStatusCode ()
| 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
| $validateCN = true

## Private Attributes
| $_sent = false
| $_responseHeaders = array()
| $_responseBody = null
| $_errorMessage = ''

## Detailed Description

Provides support for performing web-requests via curl

Definition at line 40 of file AbstractRequest.php.

## Member Function Documentation

## ◆ addCookie()

CAS_Request_AbstractRequest::addCookie | ( |  | $name,
|  |  | $value
| ) |  |

Add a cookie to the request.

Parameters

  string | $name | Name of entry
  string | $value | value of entry

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 88 of file AbstractRequest.php.

## ◆ addCookies()

CAS_Request_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 | cookies to add

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 109 of file AbstractRequest.php.

## ◆ addHeader()

CAS_Request_AbstractRequest::addHeader | ( |  | $header | ) |

Add a header string to the request.

Parameters

  string | $header | Header to add

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 128 of file AbstractRequest.php.

## ◆ addHeaders()

CAS_Request_AbstractRequest::addHeaders | ( | array | $headers | ) |

Add an array of header strings to the request.

Parameters

  array | $headers | headers to add

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 147 of file AbstractRequest.php.

## ◆ getErrorMessage()

CAS_Request_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.

Definition at line 370 of file AbstractRequest.php.

References $_errorMessage.

## ◆ getResponseBody()

CAS_Request_AbstractRequest::getResponseBody | ( |  | ) |

Answer the body of response.

Returns
  string

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

Definition at line 353 of file AbstractRequest.php.

References $_responseBody.

## ◆ getResponseHeaders()

CAS_Request_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.

Definition at line 310 of file AbstractRequest.php.

References $_responseHeaders.

## ◆ getResponseStatusCode()

CAS_Request_AbstractRequest::getResponseStatusCode | ( |  | ) |

Answer HTTP status code of the response

Returns
  int

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

Definition at line 326 of file AbstractRequest.php.

## ◆ makePost()

CAS_Request_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.

Definition at line 164 of file AbstractRequest.php.

## ◆ send()

CAS_Request_AbstractRequest::send | ( |  | ) |

Perform the request.

Returns
  bool TRUE on success, FALSE on failure.

Exceptions

  CAS_OutOfSequenceException | If called multiple times.

Definition at line 229 of file AbstractRequest.php.

References sendRequest().

## ◆ sendRequest()

CAS_Request_AbstractRequest::sendRequest | ( |  | ) |
| abstract protected

Send the request and store the results.

Returns
  bool TRUE on success, FALSE on failure.

Referenced by send().

## ◆ setPostBody()

CAS_Request_AbstractRequest::setPostBody | ( |  | $body | ) |

Add a POST body to the request

Parameters

  string | $body | body to add

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 183 of file AbstractRequest.php.

## ◆ setSslCaCert()

CAS_Request_AbstractRequest::setSslCaCert | ( |  | $caCertPath,
|  |  | $validate_cn = `true`
| ) |  |

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

Parameters

  string | $caCertPath | path to cert
  bool | $validate_cn | valdiate CN of certificate

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 208 of file AbstractRequest.php.

References $caCertPath.

## ◆ setUrl()

CAS_Request_AbstractRequest::setUrl | ( |  | $url | ) |

Set the URL of the Request

Parameters

  string | $url | Url to set

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 68 of file AbstractRequest.php.

References $url.

## ◆ storeErrorMessage()

CAS_Request_AbstractRequest::storeErrorMessage | ( |  | $message | ) |
| protected

Add a string to our error message.

Parameters

  string | $message | message to add

Returns
  void

Definition at line 295 of file AbstractRequest.php.

Referenced by CAS_Request_CurlRequest\sendRequest().

## ◆ storeResponseBody()

CAS_Request_AbstractRequest::storeResponseBody | ( |  | $body | ) |
| protected

Store the response body.

Parameters

  string | $body | body to store

Returns
  void

Definition at line 283 of file AbstractRequest.php.

Referenced by CAS_Request_CurlRequest\_storeResponseBody(), and CAS_Request_CurlRequest\sendRequest().

## ◆ storeResponseHeader()

CAS_Request_AbstractRequest::storeResponseHeader | ( |  | $header | ) |
| protected

Store a single response header to our array.

Parameters

  string | $header | header to store

Returns
  void

Definition at line 271 of file AbstractRequest.php.

Referenced by CAS_Request_CurlRequest\_curlReadHeaders().

## ◆ storeResponseHeaders()

CAS_Request_AbstractRequest::storeResponseHeaders | ( | array | $headers | ) |
| protected

Store the response headers.

Parameters

  array | $headers | headers to store

Returns
  void

Definition at line 259 of file AbstractRequest.php.

## Member Data Documentation

## ◆ $_errorMessage

CAS_Request_AbstractRequest::$_errorMessage = ''
| private

Definition at line 54 of file AbstractRequest.php.

Referenced by getErrorMessage().

## ◆ $_responseBody

CAS_Request_AbstractRequest::$_responseBody = null
| private

Definition at line 53 of file AbstractRequest.php.

Referenced by getResponseBody().

## ◆ $_responseHeaders

CAS_Request_AbstractRequest::$_responseHeaders = array()
| private

Definition at line 52 of file AbstractRequest.php.

Referenced by getResponseHeaders().

## ◆ $_sent

CAS_Request_AbstractRequest::$_sent = false
| private

Definition at line 51 of file AbstractRequest.php.

## ◆ $caCertPath

CAS_Request_AbstractRequest::$caCertPath = null
| protected

Definition at line 49 of file AbstractRequest.php.

Referenced by setSslCaCert().

## ◆ $cookies

CAS_Request_AbstractRequest::$cookies = array()
| protected

Definition at line 45 of file AbstractRequest.php.

## ◆ $headers

CAS_Request_AbstractRequest::$headers = array()
| protected

Definition at line 46 of file AbstractRequest.php.

## ◆ $isPost

CAS_Request_AbstractRequest::$isPost = false
| protected

Definition at line 47 of file AbstractRequest.php.

## ◆ $postBody

CAS_Request_AbstractRequest::$postBody = null
| protected

Definition at line 48 of file AbstractRequest.php.

## ◆ $url

CAS_Request_AbstractRequest::$url = null
| protected

Definition at line 44 of file AbstractRequest.php.

Referenced by setUrl().

## ◆ $validateCN

CAS_Request_AbstractRequest::$validateCN = true
| protected

Definition at line 50 of file AbstractRequest.php.