Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl curl

Status
Not open for further replies.

jrottman

Programmer
Jun 17, 2005
47
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
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.

Everytime 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/ -
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");
 
try this:

$curl->setopt(CURLOPT_USERPWD,"$user:$pass");

note the double-quotes

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I tried that before I posted. And I still get the same 401 error as I get with the code I posted.
 
Sorry, I have no further suggestions

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Can you try your code on a non-protected site, like yahoo.com?

Just to see if it's the user:pass business causing trouble.

~ Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top