469,287 Members | 2,637 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

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 -
Expand|Select|Wrap|Line Numbers
  1.         $curl->setopt(CURLOPT_URL, $site);
  2.         $curl->setopt(CURLOPT_USERPWD,'$user:$pass');
  3.         $curl->setopt(CURLOPT_HTTPAUTH,CURLAUTH_DIGEST);
  5.         $curl->perform;
  6.         my $err = $curl->errbuff;
  7.         my $info = $curl->getingo(CURLINFO_HTTP_CODE);

Perl code w/ system curl
Expand|Select|Wrap|Line Numbers
  1. system("curl -u $user:$pass --digest $site");
Feb 8 '08 #1
3 9665
4,059 Expert 2GB
use double-quotes when you have to join scalars to make strings

Expand|Select|Wrap|Line Numbers
  1. $curl->setopt(CURLOPT_USERPWD,"$user:$pass");
Hopefully that is all it will take to get it working.
Feb 8 '08 #2
Still gives me the same 401 error.

These are the returned headers I get.

Expand|Select|Wrap|Line Numbers
  1. HTTP/1.1 401 Unauthorized
  2. Content-Length: 1944
  3. Content-Type: text/html
  4. Server: Microsoft-IIS/6.0
  5. X-Powered-By: ASP.NET
  6. WWW-Authenticate: Digest qop="auth",realm="rets@marketlinx.com",nonce="7cae785562b23a466376b89adb9aa120",opaque="08022224248204"
  7. Date: Fri, 08 Feb 2008 22:24:24 GMT
  8. Connection: close
Feb 8 '08 #3
971 Expert 512MB
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.

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

Feb 9 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by mrbog | last post: by
3 posts views Thread by Chris Fortune | last post: by
9 posts views Thread by Conrad F | last post: by
4 posts views Thread by Ignoramus6539 | last post: by
4 posts views Thread by billb | last post: by
4 posts views Thread by rottmanj | last post: by
1 post views Thread by George Orwell | last post: by
3 posts views Thread by webb315 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.