Perl Curl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rottmanj
    New Member
    • Jan 2008
    • 46

    Perl Curl

    I am re-writing my rets application in perl, and I have found a few modules that will help me on my way. One of them being WWW::Curl:easy.

    During my testing, I have tested both system curl and perl curl. At this point I can get the system curl to correctly connect to my server. However, I am having the hardest time trying to figure out why I cant get perl curl to connect to the server.

    Every time I try to connect, I get a 401 error. I am using the same connection method that I would use if I was using system curl.

    Here is my current code. Any help with this is greatly appreciated.

    Perl Code w/ WWW::Curl:easy -
    Code:
            $curl->setopt(CURLOPT_URL, $site);
            $curl->setopt(CURLOPT_USERPWD,'$user:$pass');
            $curl->setopt(CURLOPT_HTTPAUTH,CURLAUTH_DIGEST);
            
            $curl->perform;
            my $err = $curl->errbuff;
            my $info = $curl->getingo(CURLINFO_HTTP_CODE);

    Perl code w/ system curl
    Code:
    system("curl -u $user:$pass --digest $site");
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    use double-quotes when you have to join scalars to make strings

    Code:
    $curl->setopt(CURLOPT_USERPWD,"$user:$pass");
    Hopefully that is all it will take to get it working.

    Comment

    • rottmanj
      New Member
      • Jan 2008
      • 46

      #3
      Still gives me the same 401 error.

      These are the returned headers I get.

      Code:
      HTTP/1.1 401 Unauthorized
      Content-Length: 1944
      Content-Type: text/html
      Server: Microsoft-IIS/6.0
      X-Powered-By: ASP.NET
      WWW-Authenticate: Digest qop="auth",realm="rets@marketlinx.com",nonce="7cae785562b23a466376b89adb9aa120",opaque="08022224248204"
      Date: Fri, 08 Feb 2008 22:24:24 GMT
      Connection: close

      Comment

      • eWish
        Recognized Expert Contributor
        • Jul 2007
        • 973

        #4
        The documentation is to vague to tell if you are doing things correclty. It appears that provided you have the proper username and password it should work. I have not used this module so I can't say for sure.

        Edit:
        It looks like they have an active mailing list you might seek help there if someone here can't help you.


        --Kevin

        Comment

        Working...