Enable SSL connection for https in cURL PHP (header blank) Enable SSL connection for https in cURL PHP (header blank) curl curl

Enable SSL connection for https in cURL PHP (header blank)


You're excluding the body by using curl_setopt($ch, CURLOPT_NOBODY, true);. And I don't think you need to install certificate on your machine. The following few lines will give you everything.

$url = 'https://www.fanniemae.com/content/datagrid/hist_net_yields/cur30.html';$ch = curl_init();    curl_setopt($ch, CURLOPT_URL, $url); // set urlcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); // set browser/user agent    curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header'); // get headercurl_exec($ch);function read_header($ch, $string) {    print "Received header: $string";    return strlen($string);}