php-binance-api.php
private function downloadCurlCaBundle()
    {
        $output_filename = getcwd() . "/ca.pem";

        if (is_writable(getcwd()) === false) {
            die(getcwd() . " folder is not writeable, plese check your permissions");
        }

        $host = "https://curl.haxx.se/ca/cacert.pem";
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $host);
        curl_setopt($curl, CURLOPT_VERBOSE, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);

        // proxy settings
        if (is_array($this->proxyConf)) {
            curl_setopt($curl, CURLOPT_PROXY, $this->getProxyUriString());
            if (isset($this->proxyConf['user']) && isset($this->proxyConf['pass'])) {
                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxyConf['user'] . ':' . $this->proxyConf['pass']);
            }
        }

        $result = curl_exec($curl);
        curl_close($curl);

        if ($result === false) {
            echo "Unable to to download the CA bundle $host" . PHP_EOL;
            return;
        }

        $fp = fopen($output_filename, 'w');

        if ($fp === false) {
            echo "Unable to write $output_filename, please check permissions on folder" . PHP_EOL;
            return;
        }

        fwrite($fp, $result);
        fclose($fp);
    }
private function downloadCurlCaBundle()
    {
        $output_filename = getcwd() . "/ca.pem";

        if (is_writable(getcwd()) === false) {
            die(getcwd() . " folder is not writeable, plese check your permissions");
        }

        $host = "https://curl.haxx.se/ca/cacert.pem";
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $host);
        curl_setopt($curl, CURLOPT_VERBOSE, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);

        // proxy settings
        if (is_array($this->proxyConf)) {
            curl_setopt($curl, CURLOPT_PROXY, $this->getProxyUriString());
            if (isset($this->proxyConf['user']) && isset($this->proxyConf['pass'])) {
                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxyConf['user'] . ':' . $this->proxyConf['pass']);
            }
        }

        $result = curl_exec($curl);
        curl_close($curl);

        if ($result === false) {
            echo "Unable to to download the CA bundle $host" . PHP_EOL;
            return;
        }

        $fp = fopen($output_filename, 'w');

        if ($fp === false) {
            echo "Unable to write $output_filename, please check permissions on folder" . PHP_EOL;
            return;
        }

        fwrite($fp, $result);
        fclose($fp);
    }
private function downloadCurlCaBundle ( ) { $ output_filename = getcwd ( ) . "/ca.pem" ; if ( is_writable ( getcwd ( ) ) === false ) { die ( getcwd ( ) . " folder is not writeable, plese check your permissions" ) ; } $ host = "https://curl.haxx.se/ca/cacert.pem" ; $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ host ) ; curl_setopt ( $ curl , CURLOPT_VERBOSE , 0 ) ; curl_setopt ( $ curl , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ curl , CURLOPT_HEADER , 0 ) ; curl_setopt ( $ curl , CURLOPT_SSL_VERIFYHOST , 0 ) ; curl_setopt ( $ curl , CURLOPT_SSL_VERIFYPEER , 0 ) ; // proxy settings if ( is_array ( $ this -> proxyConf ) ) { curl_setopt ( $ curl , CURLOPT_PROXY , $ this -> getProxyUriString ( ) ) ; if ( isset ( $ this -> proxyConf [ 'user' ] ) && isset ( $ this -> proxyConf [ 'pass' ] ) ) { curl_setopt ( $ curl , CURLOPT_PROXYUSERPWD , $ this -> proxyConf [ 'user' ] . ':' . $ this -> proxyConf [ 'pass' ] ) ; } } $ result = curl_exec ( $ curl ) ; curl_close ( $ curl ) ; if ( $ result === false ) { echo "Unable to to download the CA bundle $host" . PHP_EOL ; return ; } $ fp = fopen ( $ output_filename , 'w' ) ; if ( $ fp === false ) { echo "Unable to write $output_filename, please check permissions on folder" . PHP_EOL ; return ; } fwrite ( $ fp , $ result ) ; fclose ( $ fp ) ; }
Due to ongoing issues with out of date wamp CA bundles
This function downloads ca bundle for curl website
and uses it as part of the curl options
Due to ongoing issues with out of date wamp CA bundles This function downloads ca bundle for curl website and uses it as part of the curl options