Ticket #1324: wp_remote_fopen.diff
File wp_remote_fopen.diff, 909 bytes (added by , 19 years ago) |
---|
-
functions.php
1859 1859 } 1860 1860 1861 1861 function wp_remote_fopen( $uri ) { 1862 if ( function_exists('curl_init') ) { 1862 if ( ini_get('allow_url_fopen') ) { 1863 $fp = fopen( $uri, 'r' ); 1864 if ( !$fp ) 1865 return false; 1866 $linea = ''; 1867 while( $remote_read = fread($fp, 4096) ) 1868 $linea .= $remote_read; 1869 return $linea; 1870 } else if ( function_exists('curl_init') ) { 1863 1871 $handle = curl_init(); 1864 1872 curl_setopt ($handle, CURLOPT_URL, $uri); 1865 1873 curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1); … … 1868 1876 curl_close($handle); 1869 1877 return $buffer; 1870 1878 } else { 1871 $fp = fopen( $uri, 'r' ); 1872 if ( !$fp ) 1873 return false; 1874 $linea = ''; 1875 while( $remote_read = fread($fp, 4096) ) 1876 $linea .= $remote_read; 1877 return $linea; 1879 return false; 1878 1880 } 1879 1881 } 1880 1882