Note: The solution in this answer has very significant security implications. Disabling verification potentially permits a MITM attacker to use an invalid certificate to eavesdrop on the requests. Do not follow this solution unless you know exactly what the legal/security implications are and if, for some reason, you are unable to spend 2 minutes properly configuring your system.
At first you need to have enabled curl extension in PHP. Then you can use this function:
function file_get_contents_ssl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3000); // 3 sec. curl_setopt($ch, CURLOPT_TIMEOUT, 10000); // 10 sec. $result = curl_exec($ch); curl_close($ch); return $result; } It works similar to function file_get_contents(..).
Example:
echo file_get_contents_ssl("https://www.example.com/"); Output:
<!doctype html> <html> <head> <title>Example Domain</title> ...