I am trying to use a http proxy in my perl script, specifically tinyproxy. I keep getting an error "error in socket creation". can someone point out my errors and how to fix them please, would be very grateful.

my $mech = WWW::Mechanize->new();
  my $socket = new IO::Socket::INET (
  LocalHost => '',
  LocalPort => '8888',
  Proto => 'http',
  Listen => 5,
  Reuse => 1

) or die "ERROR in Socket Creation : $!\n";

  $socket->proxy(['http'], '');
  $mech->get("http://blockexplorer.com/q/getreceivedbyaddress/".$btcaddress);   # Check transactions on bitcoin address
  my $getreceived = $mech->content;
  • How is this related to Tor?
    – user3524
    Jan 5 '17 at 13:58

It is covered exactly at the WWW::Mechanize FAQ and you need to add before connecting a strings like this:



Be warned - it sets http proxy only, so if any of redirects e.t.c. will use HTTPS, you need to set https proxy too like http one.

  • Thank you that did the trick. I am sending requests and often get "too many request" connection refused. Would i be able to install proxychains, say on, then use this local address in the solution above in the script. Would it then change to a new proxy when connection is refused?for example sleep (60) then attempt to reconnect Jan 7 '17 at 1:28
  • not by itself - you will need to use either cURL or LWP::UserAgent to make a timeout&state tracking properly. Proxychains are actually not necessery there, but if you will use them - Tor's socks proxy must be strictly the first one in chain, but I do recommend you to use Tor alone : it has it's control protocol, it's a very good tool - read the docs ;)
    – Alexey Vesnin
    Jan 7 '17 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.