Page 1 of 1

file_get_contents throws an error when passed a https URL

PostPosted: 20. October 2008 02:21
by mecablaze
In PHP, file_get_contents throws an error when passed a https URL. What am I doing wrong?

I am using XAMPP hosted on a Windows XP SP3 box. According to where I downloaded the package, openSSL was enable when PHP was compiled. Is there a setting in a php.ini file that I need to enable for the server to be able to speak in https? The error file_get_contents throws is as follows:

Warning: file_get_contents(https://www.cia.gov/) [function.file-get-contents]: failed to open stream: Invalid argument in C:\xampp\htdocs\index.php on line 13

Here's my script's entirety:

Code: Select all
<?php

echo file_get_contents("https://www.cia.gov/");

?>


I have tried this same exact code on my own hosting package I am paying for, which is on a remote linux shared server, and the above code works perfectly.

Thanks,
mecablaze

PostPosted: 20. October 2008 08:43
by w4vy
have you uncommented ;extension=php_openssl.dll in your php.ini ?