Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Perl Programming Language

LWP to fill in forms: "Cookies are not Enabled on your Browser"


Hi Everyone,

I'm writing a program that fills in the username and password field on
www.facebook.com/login.php and hits submit.
The forms fill out correctly and the button is hit correctly.
However, I get an error page when my program tries to log in.  It has
the message:

"Cookies are not enabled on your browser. Please adjust this in your
security preferences before continuing."

Here is that portion of my code:

# Author: Kyri Baker
# 2007/06/05

use Tk;
use LWP;
use HTTP::Cookies;
use POSIX;
use strict;
require Tk::DialogBox;
require LWP::UserAgent;

my $ua = LWP::UserAgent->new;
$ua->cookie_jar( HTTP::Cookies->new() );
$ua->timeout(10);
$ua->env_proxy;
$ua->agent('Mozilla/5.0');

my $email='kiwi@gmail.com';
my $pass='MY_PASSWORD';
my $action = 'Login';
my $response = $ua->post('http://www.facebook.com/login.php',['email'=>
$email, 'pass'=>$pass, 'doquicklogin'=>$action]);

print $response->content;

--------
Any input at all would be great, I'm just getting into Perl.  :c)

On Jun 7, 12:47 am, Kyri <kiwi@gmail.com> wrote:

The cookie jar needs a file, e.g.,

my $cjar = "/tmp/bmb_lwpcookies.txt";  # yours will be different
my $ua = LWP::UserAgent->new(cookie_jar=>{file=>$cjar,autosave=>1});

But I haven't tested your script to see if this is the actual/only
problem.

--
Brad

On Jun 7, 7:32 am, Brad Baxter <baxter.b@gmail.com> wrote:

Ah...thank you.  This is a very ignorant question, but I currently
have cookies.txt as a blank text file and my program errors saying
"cookies.txt does not seem to contain cookies" - Am I supposed to be
sending my browser cookies?!
On Jun 7, 10:19 am, Kyri <kiwi@gmail.com> wrote:

> Ah...thank you.  This is a very ignorant question, but I currently
> have cookies.txt as a blank text file and my program errors saying
> "cookies.txt does not seem to contain cookies" - Am I supposed to be
> sending my browser cookies?!

I guess I would try deleting that file and letting your program create
it.

--
Brad

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc