使用HTTPS的Fopen Url

I am trying to send a post request to a URL with HTTPS and I keep getting an error.

This is my code:

function do_post_request($data, $optional_headers = null)   {
    $params = array('http' => array(
            'method' => 'POST',
            'content' => http_build_query($data)
            ));


    $url = 'https://url';

    $ctx = stream_context_create($params);

    $fp = @fopen($url, 'rb', false, $ctx); 

    fpassthru($fp);
    if (!$fp) {<--- falls here
        throw new Exception("Problem with $url, $php_errormsg");
    }
    $response = @stream_get_contents($fp);

    if ($response === false) {
        throw new Exception("Problem reading data from $url, $php_errormsg");
    }
    return array(substr(trim(strip_tags($response)),0,3), trim(strip_tags($response)));
}

The error i get is:

Fatal error: Uncaught exception 'Exception' with message 'Problem with https://gateWay.pelecard.biz/PayProcess/English, ' in C:\PelecardProjects\aspsite\Post\PHP\PayEng.php:103 Stack trace: #0 C:\PelecardProjects\aspsite\Post\PHP\PayEng.php(83): do_post_request(Array) #1 {main}

I read somewhere that I need to enable php OpenSSL extension maybe?

Solved, My https configuration was not good.

Did the following steps

1.Rename php.ini-production to php.ini (in php folder)

2.Edit php.ini and uncomment extension_dir=ext.

3.uncomment extension=php_openssl.dll.

4.added libeay32.dll and ssleay32.dll to C:\WINDOWS\system32\inetsrv