> 
> > Hi perlers,
> > 
> > anyone knows how to connect to a website and download it 
> through socks 
> > (ver 4,5) ? I tried IO::Socket::Socks and Net::SOCKS, but I 
> can't get 
> > them to work.
> 
> I know it can be done via 'LWP::UserAgent'. Not sure via a 
> socket though.

you could always do this:

use Socket;

$port = 80;
$host ='www.somesite.com';
$proto = getprotobyname('tcp');
$addr = gethostbyname("$host"); 
$ip = join(".", unpack("C4", $addr));

my $dest = sockaddr_in($port, inet_aton($ip));
socket(S,AF_INET,SOCK_STREAM, $proto) or die "coudn't create sock: $!";  
connect(S,$dest) or die "can't connect: $!\n"; 

select(S); $| = 1; select(STDOUT);

print S "GET / HTTP/1.0\n\n";
print while (<S>);


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.770 / Virus Database: 517 - Release Date: 9/27/2004
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to