| 1 | function wp_remote_fopen( $uri ) { |
|---|
| 2 | if ( ini_get('allow_url_fopen') ) { |
|---|
| 3 | $fp = fopen( $uri, 'r' ); |
|---|
| 4 | if ( !$fp ) |
|---|
| 5 | return false; |
|---|
| 6 | $linea = ''; |
|---|
| 7 | while( $remote_read = fread($fp, 4096) ) |
|---|
| 8 | $linea .= $remote_read; |
|---|
| 9 | return $linea; |
|---|
| 10 | } else if ( function_exists('curl_init') ) { |
|---|
| 11 | $handle = curl_init(); |
|---|
| 12 | curl_setopt ($handle, CURLOPT_URL, $uri); |
|---|
| 13 | curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1); |
|---|
| 14 | curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1); |
|---|
| 15 | $buffer = curl_exec($handle); |
|---|
| 16 | curl_close($handle); |
|---|
| 17 | return $buffer; |
|---|
| 18 | } else { |
|---|
| 19 | return false; |
|---|
| 20 | } |
|---|
| 21 | } |
|---|