Make WordPress Core

Ticket #1324: wp_remote_fopen.diff

File wp_remote_fopen.diff, 909 bytes (added by macmanx, 21 years ago)
  • functions.php

     
    18591859}
    18601860
    18611861function 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') ) {
    18631871                $handle = curl_init();
    18641872                curl_setopt ($handle, CURLOPT_URL, $uri);
    18651873                curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
     
    18681876                curl_close($handle);
    18691877                return $buffer;
    18701878        } 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;
    18781880        }       
    18791881}
    18801882