Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Author: Adam Franco <afranco@middlebury.edu>
License: http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
File Size: 179 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

CAS_Request_RequestInterface:: (13 methods):
  setUrl()
  addCookie()
  addCookies()
  addHeader()
  addHeaders()
  makePost()
  setPostBody()
  setSslCaCert()
  send()
  getResponseHeaders()
  getResponseStatusCode()
  getResponseBody()
  getErrorMessage()


Interface: CAS_Request_RequestInterface  - X-Ref

This interface defines a class library for performing web requests.

setUrl($url)   X-Ref
Set the URL of the Request

return: void
param: string $url url to set

addCookie($name, $value)   X-Ref
Add a cookie to the request.

return: void
param: string $name  name of cookie
param: string $value value of cookie

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

return: void
param: array $cookies cookies to add

addHeader($header)   X-Ref
Add a header string to the request.

return: void
param: string $header header to add

addHeaders(array $headers)   X-Ref
Add an array of header strings to the request.

return: void
param: array $headers headers to add

makePost()   X-Ref
Make the request a POST request rather than the default GET request.

return: void

setPostBody($body)   X-Ref
Add a POST body to the request

return: void
param: string $body body to add

setSslCaCert($caCertPath, $validate_cn = true)   X-Ref
Specify the path to an SSL CA certificate to validate the server with.

return: void
param: string  $caCertPath  path to cert file
param: boolean $validate_cn validate CN of SSL certificate

send()   X-Ref
Perform the request.

return: bool TRUE on success, FALSE on failure.

getResponseHeaders()   X-Ref
Answer the headers of the response.

return: array An array of header strings.

getResponseStatusCode()   X-Ref
Answer HTTP status code of the response

return: int

getResponseBody()   X-Ref
Answer the body of response.

return: string

getErrorMessage()   X-Ref
Answer a message describing any errors if the request failed.

return: string