54 $this->_curlOptions = $options;
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);
198 return strlen($header);
_storeResponseBody($body)
setCurlOptions(array $options)
_curlReadHeaders($ch, $header)
storeErrorMessage($message)
storeResponseHeader($header)