555 | | $fp = @fsockopen($host, $parts['port'], $err_num, $err_msg, 3); |
556 | | if ( !$fp ) |
557 | | return false; |
558 | | |
| 555 | if (WP_USEPROXY) { |
| 556 | $fp = fsockopen(WP_PROXYHOST, WP_PROXYPORT); |
| 557 | if (!$fp) |
| 558 | return false; |
| 559 | fputs($fp, $head); |
| 560 | fputs($fp, "Proxy-Authentication: Basic " . base64_encode(WP_PROXYUSER . ":" . WP_PROXYPASS) . "\r\n\r\n"); |
| 561 | } else { |
| 562 | $fp = @fsockopen($host, $parts['port'], $err_num, $err_msg, 3); |
| 563 | if ( !$fp ) |
| 564 | return false; |
| 565 | fputs( $fp, $head ); |
| 566 | } |
874 | | $fp = @fopen( $uri, 'r' ); |
875 | | if ( !$fp ) |
876 | | return false; |
877 | | |
878 | | //stream_set_timeout($fp, $timeout); // Requires php 4.3 |
879 | | $linea = ''; |
880 | | while( $remote_read = fread($fp, 4096) ) |
881 | | $linea .= $remote_read; |
882 | | fclose($fp); |
883 | | return $linea; |
| 881 | if (WP_USEPROXY) { |
| 882 | $proxy_fp = fsockopen(WP_PROXYHOST, WP_PROXYPORT); |
| 883 | if ( !$proxy_fp ) |
| 884 | return false; |
| 885 | fputs($proxy_fp, "GET $uri HTTP/1.0\r\nHost: ".WP_PROXYHOST." \r\n"); |
| 886 | fputs($proxy_fp, "Proxy-Authentication: Basic " . base64_encode(WP_PROXYUSER . ":" . WP_PROXYPASS) . "\r\n\r\n"); |
| 887 | while(!feof($proxy_fp)) |
| 888 | $proxy_cont .= fread($proxy_fp,4096); |
| 889 | fclose($proxy_fp); |
| 890 | $proxy_cont = substr($proxy_cont, strpos($proxy_cont, "\r\n\r\n")+4); |
| 891 | return $proxy_cont; |
| 892 | } else { |
| 893 | $fp = fopen( $uri, 'r' ); |
| 894 | if ( !$fp ) |
| 895 | return false; |
| 896 | $linea = ''; |
| 897 | while( $remote_read = fread($fp, 4096) ) |
| 898 | $linea .= $remote_read; |
| 899 | fclose($fp); |
| 900 | return $linea; |
| 901 | } |
884 | 902 | } else if ( function_exists('curl_init') ) { |
885 | 903 | $handle = curl_init(); |
886 | 904 | curl_setopt ($handle, CURLOPT_URL, $uri); |
887 | 905 | curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1); |
888 | 906 | curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1); |
889 | 907 | curl_setopt ($handle, CURLOPT_TIMEOUT, $timeout); |