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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with cookies and proxy in perl (LWP problem) 1

Status
Not open for further replies.

TorTukiTu

Programmer
Jun 19, 2008
2
0
0
FR
Hi, =)
I'im a noobi in perl. I try to write a code wich connect me to a website through a proxy and uses some cookies file. Here is the code:


#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Cookies;
die "Example: perl $0 unless @ARGV;
system("color f");
$browser = LWP::UserAgent->new() or die "Could not initialize browser\n";
#On se connecte a notre proxy
$browser->agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
$browser->proxy('http', '58.30.16.154:80');
#A present on s'occupe de nos cookies
$browser->cookie_jar( HTTP::Cookies->new(file => "cookies.txt"));
#Puis on envoie la requete
$host = $ARGV[0] . "sous_rep1/sous_rep2/";
$res = $browser->request(HTTP::Request->new(GET=>$host));
$answer = $res->content;


But when I execute it, I encounter the following erros:

Use of uninitialized value $scheme in hash element at C:/Users/****/Deskto
p/Icones/ActivePerl-5.10.0.1001-MSWin32-x86-283495/perl/lib/LWP/Protocol.pm line
55.
Use of uninitialized value $scheme in pattern match (m//) at C:/Users/****
/Desktop/Icones/ActivePerl-5.10.0.1001-MSWin32-x86-283495/perl/lib/LWP/Protocol.
pm line 58.
Use of uninitialized value $scheme in concatenation (.) or string at C:/Users/****/Desktop/Icones/ActivePerl-5.10.0.1001-MSWin32-x86-283495/perl/lib/LWP/P
rotocol.pm line 38.
Use of uninitialized value $scheme in string eq at C:/Users/****/Desktop/I
cones/ActivePerl-5.10.0.1001-MSWin32-x86-283495/perl/lib/LWP/UserAgent.pm line 1
95.

I tried to see everywhere on google if I can found a solution, but i wasn't able to find some.
If someone can explain me why i have thoses error mesages, it would be great =). Thank you for reading that thread.
 
get rid of the -w after the perl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
That's ok it was the -w THANK YOU VERY MUCH !!! =D <3 u !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top