1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

proxies in perl?

Discussion in 'PHP & Perl' started by dirtbag, Mar 8, 2009.

  1. dirtbag

    dirtbag Senior Member

    Joined:
    Jul 24, 2008
    Messages:
    990
    Likes Received:
    525
    i have looked at a couple modules on cpan, and read the perldocs.. i don't really have much of an nderstanding as the docs are fairly thin. google hasn;t turned up a whole lot. if i build, say, a forum spammer. and i want to introduce proxies for the posting, what sthe best route to go?
     
  2. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    Well OP is over a week old, but if your still looking...

    I have not tested this, but I imagine that libcurl for PERL has the same proxy support as libcurl for PHP. So it would probably look something like this:

    Code:
    #!/usr/bin/perl
    #
    
    use strict;
    use WWW::Curl::Easy;
    
    my $url = "http://forums.dp.com/";
    my $proxy = "69.69.69.69";
    my $port = "8080";
    
    # Init the curl session
    my $curl= WWW::Curl::Easy->new() or die "curl init failed!\n";
    
    # Follow location headers
    $curl->setopt(CURLOPT_FOLLOWLOCATION, 1);
                                                                            
    $curl->setopt(CURLOPT_URL, $url);
    
    # Enable proxy support
    $curl->setopt(CURLOPT_PROXY, $proxy);
    $curl->setopt(CURLOPT_PROXYPORT, $port);
    
    and so on and so forth...
    
    
    
    
     
    • Thanks Thanks x 1
  3. dirtbag

    dirtbag Senior Member

    Joined:
    Jul 24, 2008
    Messages:
    990
    Likes Received:
    525
    thanks, i'll loo this ove rin a day or two when i free up some time. for now i'm playing around with using LWP::UserAgent's proxy support. I'll check all options though :)
     
  4. cashcow

    cashcow Junior Member

    Joined:
    Sep 15, 2008
    Messages:
    162
    Likes Received:
    22
    like this:

    $ua->proxy(['http', 'ftp'], 'http://proxy:8080/');

    set this before you send out the $ua request