Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old January 24th, 2001, 09:47 PM
Siebharrin Siebharrin is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 0 Siebharrin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Siebharrin
Angry

Greetings.

My problem seems to be that I'm behind a firewall...
And the point of this script, is to GET a page first (to get
the cookie). Then fill in a form, then get the HTML
of the page which I get after filling in the form.

My problem lies in the fact that I need a "referer" from
the first page, which the normal UserAgent doesn't handle.

So how can I "fake" a referer?

This is part of my script:


#create the user agent
$ua = LWP::UserAgent->new;

#create a cookie jar and say where the cookie goes
$ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt",
autosave => 1));
$ua->agent("$0/0.1 " . $ua->agent);

#for my script I get the page first so I get the cookie
$req = HTTP::Request->new(GET => $SITE');
$req->header('Accept' => 'text/html');

# send request
$res = $ua->request($req);

#if we got the first page, we try to fill in the form.
if ($res->is_success) {
my $req = POST '$SITE',
[ username => 'user', password => 'pass', ];
$postres = $ua->request($req);
if ($postres->is_success) {
print "$postres->content;n";
} else {
print "Error in posting: " .$postres->statusline . "n";
}
} else { print "Error in getting webpage: " . $res->statusline . "n";
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Need help with Referer in query_env


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway