Ticket #1324: wp_remote_fopen.2.diff
| File wp_remote_fopen.2.diff, 1.4 KB (added by , 21 years ago) |
|---|
-
xmlrpc.php
1186 1186 $context = str_replace('&', '&', $context); 1187 1187 } 1188 1188 1189 fclose($fp);1190 1191 1189 if (empty($context)) { 1192 1190 // URL pattern not found 1193 1191 return new IXR_Error(17, 'The source URI does not contain a link to the target URI, and so cannot be used as a source.'); -
wp-includes/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 fclose($fp); 1870 return $linea; 1871 } else if ( function_exists('curl_init') ) { 1863 1872 $handle = curl_init(); 1864 1873 curl_setopt ($handle, CURLOPT_URL, $uri); 1865 1874 curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1); … … 1868 1877 curl_close($handle); 1869 1878 return $buffer; 1870 1879 } 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; 1880 return false; 1878 1881 } 1879 1882 } 1880 1883