Error: Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
There are 3 solutions:
1. For PHP under windows, you only need to delete the ; in front of extension=php_openssl.dll in php.ini and restart the service.
2. For PHP under Linux, you must install the openssl module. After installation, you can access it.
3. If you cannot modify the configuration of the server, then use the curl function to replace the file_get_contents function. Of course, it is not a simple replacement. There are also corresponding parameter configurations to use the curl function normally.
The curl function is encapsulated as follows:
Copy code The code is as follows:
function http_request($url,$timeout=30,$header=array()) {
if (!function_exists('curl_init')) {
throw new Exception('server not install curl');
$ch = curl_init();
curl_setopt($ ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_T IMEOUT, $timeout);
list($header, $ data) = explode("rnrn", $data);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code == 301 || $http_code == 302) {
$ matches = array();
preg_match('/Location:(.*?)n/', $header, $matches);
$url = trim(array_pop($matches));
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
$data = curl_exec($ch);
} if ($data = = false) {
curl_close($ch);
http://www.bkjia.com/PHPjc/621685.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/621685.html
TechArticle
Error: Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? There are 3 solutions: 1. PHP under windows, just...