A simple PHP access to the remote file content of the function code, strong compatibility. Direct calls make it easy to get the contents of a remote file, and you can use this function to get pictures. The code is as follows:
/**
* Read remote content
* @return String */
function get_url_content ($url) {
if (function_exists) ("Curl_init" ) {
$ch = Curl_init ();
$timeout =;
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);
else{
$is _auf=ini_get (' Allow_url_fopen ')? True:false;
if ($is _auf) {
$file _contents = file_get_contents ($url);
}
}
return $file _contents;
}
The above is the PHP to get the content of the remote file function code, I hope this article for everyone to learn PHP programming help.