Hi,
I have a very small simple program below which does the following:
1) post a username & password to a website - THIS WORKS
2) follow a link - THIS WORKS
3) update values of 2 fields and post the form - ERROR!
This works fine using firefox even with javascript turned off.
But when using Perl (v5.8.8 on FC5) I get a page back stating an error has occured:
"We're sorry, an error has occurred. Please review the error below
There has been a server error, please try again later (ME-WT-04)."
Any help would be great.
############### ############### ############### ##
CODE
############### ############### ############### ##
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
use LWP:: Debug qw(+); # remove the space between :: and Debug
# params
my $url = "http://www.vodafone.ie/";
my $username = "XXXXXXXXXX ";
my $password = "XXXX";
my $number = "0857431234 ";
my $message = "HELLO THERE FROM MECH";
# setup
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTT P::Cookies->new());
$mech->agent_alias( 'Windows IE 6' );
# post login
$mech->get($url);
$mech->form_name('log inform');
$mech->field('usernam e' => $username);
$mech->field('passwor d' => $password);
$mech->click();
# follow 1st link with "webtext" in it
$mech->follow_link( url_regex => qr/webtext/i );
# post message and number
$mech->form_name('Web Text');
$mech->field('message ' => $message);
$mech->field('recipie nts[0]' => $number);
$mech->click();
############### ############### ############### ##
LWP Debug qw(+) OUTPUT
############### ############### ############### ##
LWP::UserAgent: :new: ()
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET http://www.vodafone.ie/
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 12 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: POST https://www.vodafone.ie/myv/services/login/Login.shtml
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
HTTP::Cookies:: extract_cookies : Set cookie JSESSIONID => B56374FB9F26997 837ECFC18F30295 03
HTTP::Cookies:: extract_cookies : Set cookie SITESELECTION => PERSONAL
LWP::UserAgent: :request: Simple response: Found
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET https://www.vodafone.ie/myv/index.jsp
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 1448 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET https://www.vodafone.ie/myv/messaging/webtext/index.jsp?ts=11 69527959878
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 1448 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: POST https://www.vodafone.ie/myv/messaging/webtext/Process.shtml
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::UserAgent: :request: Simple response: Found
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET http://www.vodafone.ie/myv/messaging/webtext/Error.shtml
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 1448 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
I have a very small simple program below which does the following:
1) post a username & password to a website - THIS WORKS
2) follow a link - THIS WORKS
3) update values of 2 fields and post the form - ERROR!
This works fine using firefox even with javascript turned off.
But when using Perl (v5.8.8 on FC5) I get a page back stating an error has occured:
"We're sorry, an error has occurred. Please review the error below
There has been a server error, please try again later (ME-WT-04)."
Any help would be great.
############### ############### ############### ##
CODE
############### ############### ############### ##
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
use LWP:: Debug qw(+); # remove the space between :: and Debug
# params
my $url = "http://www.vodafone.ie/";
my $username = "XXXXXXXXXX ";
my $password = "XXXX";
my $number = "0857431234 ";
my $message = "HELLO THERE FROM MECH";
# setup
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTT P::Cookies->new());
$mech->agent_alias( 'Windows IE 6' );
# post login
$mech->get($url);
$mech->form_name('log inform');
$mech->field('usernam e' => $username);
$mech->field('passwor d' => $password);
$mech->click();
# follow 1st link with "webtext" in it
$mech->follow_link( url_regex => qr/webtext/i );
# post message and number
$mech->form_name('Web Text');
$mech->field('message ' => $message);
$mech->field('recipie nts[0]' => $number);
$mech->click();
############### ############### ############### ##
LWP Debug qw(+) OUTPUT
############### ############### ############### ##
LWP::UserAgent: :new: ()
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET http://www.vodafone.ie/
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 12 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: POST https://www.vodafone.ie/myv/services/login/Login.shtml
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
HTTP::Cookies:: extract_cookies : Set cookie JSESSIONID => B56374FB9F26997 837ECFC18F30295 03
HTTP::Cookies:: extract_cookies : Set cookie SITESELECTION => PERSONAL
LWP::UserAgent: :request: Simple response: Found
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET https://www.vodafone.ie/myv/index.jsp
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 1448 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET https://www.vodafone.ie/myv/messaging/webtext/index.jsp?ts=11 69527959878
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 1448 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: POST https://www.vodafone.ie/myv/messaging/webtext/Process.shtml
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::UserAgent: :request: Simple response: Found
LWP::UserAgent: :request: ()
HTTP::Cookies:: add_cookie_head er: Checking www.vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: - checking cookie path=/
HTTP::Cookies:: add_cookie_head er: - checking cookie SITESELECTION=P ERSONAL
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: - checking cookie JSESSIONID=B563 74FB9F26997837E CFC18F3029503
HTTP::Cookies:: add_cookie_head er: it's a match
HTTP::Cookies:: add_cookie_head er: Checking .vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking vodafone.ie for cookies
HTTP::Cookies:: add_cookie_head er: Checking .ie for cookies
LWP::UserAgent: :send_request: GET http://www.vodafone.ie/myv/messaging/webtext/Error.shtml
LWP::UserAgent: :_need_proxy: Not proxied
LWP::Protocol:: http::request: ()
LWP::Protocol:: collect: read 1448 bytes ....(rest of reads cut out)
LWP::UserAgent: :request: Simple response: OK
Comment