mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Use CURL if available, possible fix for http://mosquito.wordpress.org/view.php?id=1166
git-svn-id: https://develop.svn.wordpress.org/trunk@2581 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1858,4 +1858,24 @@ function add_magic_quotes($array) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
?>
|
||||
function wp_remote_fopen( $uri ) {
|
||||
if ( function_exists('curl_init') ) {
|
||||
$handle = curl_init();
|
||||
curl_setopt ($handle, CURLOPT_URL, $uri);
|
||||
curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
|
||||
curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1);
|
||||
$buffer = curl_exec($handle);
|
||||
curl_close($handle);
|
||||
return $buffer;
|
||||
} else {
|
||||
$fp = fopen( $uri, 'r' );
|
||||
if ( !$fp )
|
||||
return false;
|
||||
$linea = '';
|
||||
while( $remote_read = fread($fp, 4096) )
|
||||
$linea .= $remote_read;
|
||||
return $linea;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user