phpCAS version 1.3.6

Public Member Functions | List of all members
CAS_Request_RequestInterface Class Reference
Inheritance diagram for CAS_Request_RequestInterface:

## 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 ()

## Detailed Description

This interface defines a class library for performing web requests.

Definition at line 40 of file RequestInterface.php.

## Member Function Documentation

## ◆ addCookie()

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

Add a cookie to the request.

Parameters

  string | $name | name of cookie
  string | $value | value of cookie

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

## ◆ addCookies()

CAS_Request_RequestInterface::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.

## ◆ addHeader()

CAS_Request_RequestInterface::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.

Referenced by CAS_ProxiedService_Http_Post\populateRequest().

## ◆ addHeaders()

CAS_Request_RequestInterface::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.

## ◆ getErrorMessage()

CAS_Request_RequestInterface::getErrorMessage | ( |  | ) |

Answer a message describing any errors if the request failed.

Returns
  string

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

## ◆ getResponseBody()

CAS_Request_RequestInterface::getResponseBody | ( |  | ) |

Answer the body of response.

Returns
  string

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

## ◆ getResponseHeaders()

CAS_Request_RequestInterface::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.

## ◆ getResponseStatusCode()

CAS_Request_RequestInterface::getResponseStatusCode | ( |  | ) |

Answer HTTP status code of the response

Returns
  int

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

## ◆ makePost()

CAS_Request_RequestInterface::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.

Referenced by CAS_ProxiedService_Http_Post\populateRequest().

## ◆ send()

CAS_Request_RequestInterface::send | ( |  | ) |

Perform the request.

Returns
  bool TRUE on success, FALSE on failure.

Exceptions

  CAS_OutOfSequenceException | If called multiple times.

## ◆ setPostBody()

CAS_Request_RequestInterface::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.

Referenced by CAS_ProxiedService_Http_Post\populateRequest().

## ◆ setSslCaCert()

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

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

Parameters

  string | $caCertPath | path to cert file
  boolean | $validate_cn | validate CN of SSL certificate

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

## ◆ setUrl()

CAS_Request_RequestInterface::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.