file_get_contents () Get HTTPS this error unable to find the wrapper "https"

Source: Internet
Author: User
Tags curl php file wrapper

File_get_contents () gets HTTPS for this error unable to find the wrapper "https" –did

Solution One, if you are using the server, you can refer to this approach, modify the PHP configuration file (win host) to support HTTPS

Find and modify in php.ini

Extension=php_openssl.dll
Allow_url_include = On

Restart the service on it, if you are a Linux server, Linux under the PHP, you must install the OpenSSL module, installed in the future can be visited.

Solution Two, if you are not using the server, you use the host, you cannot change the configuration of PHP, you can use the Curl function to replace the file_get_contents function, of course, your host must support the Curl function.

<?php

function Getsslpage ($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);
$result = curl_exec ($ch);
Curl_close ($ch);
return $result;
}
echo getsslpage ($_get[' url '));
?>

Check to see if the host supports PHP's file_get_contents function

Talk about the code stored as a PHP file, running in space, you can get results.

<?php
Echo ' Curl: ', function_exists (' curl_version ')? ' Enabled ': ' Disabled '. ' <br/>
File_get_contents: ', file_get_contents (__file__)? ' Enabled ': ' Disabled ';
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.