Make WordPress Core


Ignore:
Timestamp:
05/03/2005 07:52:11 AM (21 years ago)
Author:
matt
Message:

Use CURL if available, possible fix for http://mosquito.wordpress.org/view.php?id=1166

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2572 r2581  
    18591859}
    18601860
     1861function wp_remote_fopen( $uri ) {
     1862    if ( function_exists('curl_init') ) {
     1863        $handle = curl_init();
     1864        curl_setopt ($handle, CURLOPT_URL, $uri);
     1865        curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
     1866        curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1);
     1867        $buffer = curl_exec($handle);
     1868        curl_close($handle);
     1869        return $buffer;
     1870    } 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;
     1878    }   
     1879}
     1880
    18611881?>
Note: See TracChangeset for help on using the changeset viewer.