CAS_Client::_readURL PHP Method

_readURL() private method

This method is used to acces a remote URL.
private _readURL ( string $url, &$headers, &$body, &$err_msg ) : true
$url string the URL to access.
return true on success, false otherwise (in this later case, $err_msg contains an error message).
    private function _readURL($url, &$headers, &$body, &$err_msg)
    {
        phpCAS::traceBegin();
        $className = $this->_requestImplementation;
        $request = new $className();
        if (count($this->_curl_options)) {
            $request->setCurlOptions($this->_curl_options);
        }
        $request->setUrl($url);
        if (empty($this->_cas_server_ca_cert) && !$this->_no_cas_server_validation) {
            phpCAS::error('one of the methods phpCAS::setCasServerCACert() or phpCAS::setNoCasServerValidation() must be called.');
        }
        if ($this->_cas_server_ca_cert != '') {
            $request->setSslCaCert($this->_cas_server_ca_cert, $this->_cas_server_cn_validate);
        }
        // add extra stuff if SAML
        if ($this->getServerVersion() == SAML_VERSION_1_1) {
            $request->addHeader("soapaction: http://www.oasis-open.org/committees/security");
            $request->addHeader("cache-control: no-cache");
            $request->addHeader("pragma: no-cache");
            $request->addHeader("accept: text/xml");
            $request->addHeader("connection: keep-alive");
            $request->addHeader("content-type: text/xml");
            $request->makePost();
            $request->setPostBody($this->_buildSAMLPayload());
        }
        if ($request->send()) {
            $headers = $request->getResponseHeaders();
            $body = $request->getResponseBody();
            $err_msg = '';
            phpCAS::traceEnd(true);
            return true;
        } else {
            $headers = '';
            $body = '';
            $err_msg = $request->getErrorMessage();
            phpCAS::traceEnd(false);
            return false;
        }
    }
CAS_Client