Hey guys, I need to mofidy the following code to communicate via a proxy server, can anyone please advise on how to do this?" function fetchURL( $url ) { $url_parsed = parse_url( $url ); $host = $url_parsed['host']; $port = $url_parsed['port']; if ( $port == 0 ) { $port = 80; } $path = $url_parsed['path']; if ( $url_parsed['query'] != "" ) { $path .= "?".$url_parsed['query']; } $out = "GET ".$path." HTTP/1.0\r\nHost: {$host}\r\n\r\n"; $fp = @fsockopen( @$host, $port, &$errno, &$errstr, 30 ); if ( $fp ) { $in = "Unknown"; return $in; } fwrite( $fp, $out ); $body = FALSE; while ( !feof( $fp ) ) { $s = fgets( $fp, 1024 ); if ( $body ) { $in .= $s; } if ( $s == "\r\n" ) { $body = TRUE; } } fclose( $fp ); return $in; } PHP:
It's very easy. Just change this part: $fp=@fsockopen(@$host,$port,&$errno,&$errstr,30) With your proxy IP and port and leave the rest of the code as is. It will work.