CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Viewing a webpage with a cookie.

 



tehKitten
New User

Jun 24, 2009, 12:55 PM

Post #1 of 3 (521 views)
Viewing a webpage with a cookie. Can't Post

Hello people! My first post here ^.^"

Okay, let's start the question.

I'm trying now for several weeks to create a little perl script, that can view a page of a forum, and using a cookie when he is viewing the page. Just like you are now doing with this forum. ;)
I want him for example, go to the homepage, click the "New Posts" button, and save that page to a file.
I have the cookie as an .txt, exported from Firefox.

Can anybody please write a little piece of code for me?

Grz tehKitten

p.s. Excuse me for my English if I have made any mistakes, I'm Dutch ;p


KevinR
Veteran


Jun 26, 2009, 8:15 AM

Post #2 of 3 (509 views)
Re: [tehKitten] Viewing a webpage with a cookie. [In reply to] Can't Post

You say you have been trying, can we see the code you have been trying?
-------------------------------------------------


tehKitten
New User

Jun 27, 2009, 12:39 AM

Post #3 of 3 (496 views)
Re: [KevinR] Viewing a webpage with a cookie. [In reply to] Can't Post

Well.. everytime when a script didn't worked, I deleted it, and created a new one.. But this are my last one's


Code
use LWP::UserAgent; 

# Prepare request.
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request(GET => 'http://www.site.com/home.php');
$req->authorization_basic("Username", "Password");

# Request file.
print "$req\n";


and


Code
 use LWP::Simple; 
use LWP::Simple::Cookies ( autosave => 1,
file => "E:\cookies.txt" );

# Cookies are now used.
get("http://www.site.com/home.php");


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives