73 $buf = curl_exec($ch);
77 'CURL error #' . curl_errno($ch) .
': ' . curl_error($ch)
104 $ch = curl_init($this->url);
106 if (version_compare(PHP_VERSION,
'5.1.3',
'>=')) {
108 curl_setopt_array($ch, $this->_curlOptions);
110 foreach ($this->_curlOptions as
$key => $value) {
111 curl_setopt($ch,
$key, $value);
118 if ($this->caCertPath) {
119 if ($this->validateCN) {
120 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
122 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
124 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
125 curl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath);
126 phpCAS::trace(
'CURL: Set CURLOPT_CAINFO ' . $this->caCertPath);
128 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
129 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
136 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
139 curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this,
'_curlReadHeaders'));
144 if (count($this->cookies)) {
145 $cookieStrings = array();
146 foreach ($this->cookies as
$name => $val) {
147 $cookieStrings[] =
$name .
'=' . $val;
149 curl_setopt($ch, CURLOPT_COOKIE, implode(
';', $cookieStrings));
155 if (count($this->headers)) {
156 curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
163 curl_setopt($ch, CURLOPT_POST, 1);
164 curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postBody);
sendRequest()
Send the request and store the results.
_storeResponseBody($body)
Store the response body.
This interface defines a class library for performing web requests.
setCurlOptions(array $options)
Set additional curl options.
Provides support for performing web-requests via curl.
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
static trace($str)
This method is used to log something in debug mode.
_curlReadHeaders($ch, $header)
Internal method for capturing the headers from a curl request.
Provides support for performing web-requests via curl.
foreach($_POST as $key=> $value) $res
storeErrorMessage($message)
Add a string to our error message.
initAndConfigure()
Internal method to initialize our cURL handle and configure the request.
storeResponseHeader($header)
Store a single response header to our array.
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
storeResponseBody($body)
Store the response body.