75 $buf = curl_exec($ch);
76 if ( $buf ===
false ) {
79 'CURL error #'.curl_errno($ch).
': '.curl_error($ch)
107 $ch = curl_init($this->url);
109 if (version_compare(PHP_VERSION,
'5.1.3',
'>=')) {
111 curl_setopt_array($ch, $this->_curlOptions);
113 foreach ($this->_curlOptions as $key => $value) {
114 curl_setopt($ch, $key, $value);
121 if ($this->caCertPath) {
122 if ($this->validateCN) {
123 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
125 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
127 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
128 curl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath);
129 phpCAS::trace(
'CURL: Set CURLOPT_CAINFO ' . $this->caCertPath);
131 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
132 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
139 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
142 curl_setopt($ch, CURLOPT_HEADERFUNCTION,
array($this,
'_curlReadHeaders'));
147 if (count($this->cookies)) {
148 $cookieStrings =
array();
149 foreach ($this->cookies as $name => $val) {
150 $cookieStrings[] = $name.
'='.$val;
152 curl_setopt($ch, CURLOPT_COOKIE, implode(
';', $cookieStrings));
158 if (count($this->headers)) {
159 curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
166 curl_setopt($ch, CURLOPT_POST, 1);
167 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.
if(!is_array($argv)) $options
storeErrorMessage($message)
Add a string to our error message.
initAndConfigure()
Internal method to initialize our cURL handle and configure the request.
Create styles array
The data for the language used.
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.