SSL Request

Hi (probably Jonathan),

I have a little question that I am hoping you can answer:
I wish to send an SSL request to a web server and then record the response. I understand that I need to install some sort of a module that contains the SSL libraries. Do you have this SSL library installed and if so where can I get them? I have tried with ppm, but ppm cant seem to find any SSL libs.

I am running W2K with Perl 5.6.1

Thanks!
Regards,
sharpe

Comments

  • : Hi (probably Jonathan),
    Maybe I should try to be less dominating on the Perl board? ;-)

    : I have a little question that I am hoping you can answer:
    : I wish to send an SSL request to a web server and then record the
    : response. I understand that I need to install some sort of a module
    : that contains the SSL libraries. Do you have this SSL library
    : installed and if so where can I get them? I have tried with ppm, but
    : ppm cant seem to find any SSL libs.
    I have done this before but am at college at the moment (just had one of my physics finals) and don't have the code I used to hand, which would probably tell me which libraries I used. As I remember, I used LWP and used something called SSLeay to enable it to work with SSL. Yup, here it is:-

    http://search.cpan.org/author/CHAMAS/Crypt-SSLeay-0.51/SSLeay.pm

    : I am running W2K with Perl 5.6.1
    This was on Linux with Perl 5.6.0. There is a note at the above URL about Windows which I've popped below:-

    "If you cannot get it to build on your windows box, try ActiveState perl, at least their builds 522 & 618 are known to have a ppm install of Crypt::SSLeay available. Please see http://www.activestate.com for more info."

    So try looking for Crypt::SSLeay on PPM and installing that, then get LWP if you ain't already got it.

    I'll post some example code later on when I dig it out.

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • Hi,

    I promised code, I'm delivering code. :-)

    [code]#Use the required modules. I don't know if you need to explicitly
    #use NET::SSL as well, but it works out with it there...
    use LWP::UserAgent;
    use Net::SSL;

    #Build the query string you want to send (this is for POST).
    #Just use the normal name=value pairs seperated by an &. Do
    #remember to escape &s and =s or you might get a nasty suprise.
    my $query = "a=$a&b=$b";

    #Create user agent object.
    my $ua = new LWP::UserAgent;

    #Create request object.
    my $req = new HTTP::Request 'POST','https://some.url/';
    $req->content_type('application/x-www-form-urlencoded');
    $req->content($query);

    #Do request.
    my $response = $ua->request($req);

    #Print response, but do whatever you want with it. Note it's a
    #method call so you can't interpolate it. Don't make my mistake
    #of trying to do print $response either - it'll print a hash
    #reference from what I remember. ;-)
    print $response->content();
    [/code]

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • Looks likes it may become a problem getting it for win32. I better use my linux box for this one.

    You would have thought that they could sort that out huh? I suppose they have enough to see to!

    Thanks again Jonathan!
    Have a good weekend!

    PS. How did your exams go?
  • : Looks likes it may become a problem getting it for win32. I better
    : use my linux box for this one.
    Did you try installing those modules on your Win32 box?

    : You would have thought that they could sort that out huh? I suppose
    : they have enough to see to!
    Yeah, I'd imagine that ActiveState people are pretty busy. Wait to see how busy they'll be when Perl 6 comes out!

    : Thanks again Jonathan!
    You're welcome...

    : Have a good weekend!
    And thanks. :-)

    : PS. How did your exams go?
    Pretty good overall, thankfully. Just one left to do on Thursday, then on the Saturday at 6 AM I'm flying to Switzerland and spending a week wondering around the mountains and taking a break from my computer, and academia in general. :-) (Yup, no posts on the Perl board from me for a week.) Thanks for asking! 1:40 AM. Bedtime maybe? ;-)

    Take care,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories