Problem description
fopen (), file_get_contents (), getimagesize () and so on are not normal access to the content of the network, the specific performance of any parameter is a URL, all return null value
If Windows can be found
Allow_url_fopen Open
If Linux can
Recompile php, remove the –with-curlwrapper parameter--before compiling remember to perform make clean first.
When Windows was not opening the allow_url_fopen, we used
| The code is as follows |
Copy Code |
< PHP $file _contents = file_get_contents (' http://www.111cn.net/'); echo $file _contents; ?> |
is not getting the value, but we can use function_exists to determine whether this function is available.
| The code is as follows |
Copy Code |
function File_get_content ($url) { if (function_exists (' file_get_contents ')) { $file _contents = @file_get_contents ($url); } if ($file _contents = = ") { $ch = Curl_init (); $timeout = 30; curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_connecttimeout, $timeout); $file _contents = curl_exec ($ch); Curl_close ($ch); } return $file _contents; }
|