1,ini_get:returns The value of the configuration option as a string on success, or a empty string on failure (read PHP teaching The value in the path. ini configuration file)
2,; Whether to allow the treatment of URL (like http://or ftp://) as files.
Allow_url_fopen = On (content in profile)
3,fopen ("RB"): If you do not specify ' B ' tags when manipulating binaries, you may encounter some strange problems, including bad picture files and strange questions about RN characters.
Note: For portability reasons, it is strongly recommended that you always use the ' B ' flag when you open a file with fopen ().
Note: Again, for porting considerations, it is strongly recommended that you rewrite the code that relies on the ' t ' pattern to use the correct line terminator and change it to ' B ' mode.
4,strtolower--Make a string lowercase
5,curl_init (): Curl_init--Initialize A Curl session (initialize a Curl conversation)
.
/**
Gets the remote file contents
@param $url File http address
*/
Function Fopen_url ($url)
{
If function_exists (' fi Le_get_contents ') {
$file _content = @file_get_contents ($url);
} elseif (Ini_get (' Allow_url_fopen ') && ($file = @fopen ($url, ' RB ')) {
$i = 0;
while (!feof ($file) && $i + + < 1000) {
$file _content. = Strtolower (Fread ($file, 4096));
}
Fclose ($file);
} elseif (function_exists (' Curl_init ')) {
$curl _handle = Curl_init ();
curl_setopt ($curl _handle, Curlopt_url, $url);
curl_setopt ($curl _handle, curlopt_connecttimeout,2);
curl_setopt ($curl _handle, curlopt_returntransfer,1);
curl_setopt ($curl _handle, curlopt_failonerror,1);
curl_setopt ($curl _handle, curlopt_useragent, ' Trackback Spam check ');//reference spam check
$file _content = curl_exec ($ Curl_handle);
Curl_close ($curl _handle);
} else {
$file _content = ';
}
return $file _content;
}