greenphoenix has asked for the wisdom of the Perl Monks concerning the following question:

Hey there,
I have a pretty perplexing problem. I'm trying to post data to a secure site. The ISP I have has Crypt::SSLeay installed as a module, but I continue to get the following error:

ctx is not an Crypt::SSLeay::CTX, <POSTDATA> chunk 1.

Here's the code:

use LWP::UserAgent; use Crypt::SSLeay; $hdrs = new HTTP::Headers(Accept => 'text/plain', User-Agent => 'MegaB +rowser/1.0'); $url = new URI::URL('https://payflowlink.verisign.com/payflowlink.cfm' +); $url = new URI::URL('https://www.nodeworks.com'); $req = new HTTP::Request('GET', $url, $hdrs); $ua = new LWP::UserAgent; $resp = $ua->request($req); if ($resp->is_success) { print "did work. yay!"; print $resp->content; } else { print "didn't work.\n"; print $resp->message; }


Any idea what's going on? Thanks in advance!

Replies are listed 'Best First'.
Re: CTX:SSLeay and https
by BeernuT (Pilgrim) on Mar 18, 2002 at 01:29 UTC
    You are missing
    use URI::URL;
    once I added that the code worked.
    Edit: After reviewing the code again I must add
    use strict; use warnings;
    You define $url twice, and have a bareword 'User-Agent' which looks like it should be 'User_Agent'.

    -bn

      This solves the problem. But I must say this: URI::URL is a deprecated/obsolete/whatever module, and is only provided for backwards compability. You should use the newer URI module instead. Raw URI has a nicer interface, I think anyway. Using obsolete modules is generally a bad thing to do, unless you really have to.


      --
      my one true love