www-mechanize

Is there a PHP equivalent of Perl's WWW::Mechanize?

I'm looking for a library that has functionality similar to Perl's WWW::Mechanize, but for PHP. Basically, it should allow me to submit HTTP GET and POST requests with a simple syntax, and then parse the resulting page and return in a simple format all forms and their fields, along with all links on the page. I know about CURL, but it's...

Iconv::IllegalSequence when using www::mechanize

I'm trying to do a little bit of webscraping, but the WWW:Mechanize gem doesn't seem to like the encoding and crashes :-/ The post request results in a 302 redirect (which mechanize follows, so far so good) and the resulting page seems to crash it :-/ I googled quite a bit, but nothing came up so far how to solve this. Any of you got an ...

Python: how to dump cookies of a mechanize.Browser instance?

I am learning mechanize. mechanize is a python module to automate web browsing. One of its features is automated handling of cookies. I would like a hint about the way to dump the cookies for a mechanize.Browser instance. I can't seem to figure this out myself. I need this for debug purposes. ...

WWW::Mechanize and "HTTP::Message content must be bytes at..."

I'm writing simple program which has to change some data on Polish auction site. One of the steps involves loading edit page, changing one value, and submitting it. Sample page can be viewed here: http://depesz.com/various/new_item.php.html - this is just static copy of such edit page. Relevant part of my perl code: $agent->form_numb...

Transparently Handling GZip Encoded content with WWW::Mechanize

Hi, I am using WWW::Mechanize and currently handling HTTP responses with the 'Content-Encoding: gzip' header in my code by first checking the response headers and then using IO::Uncompress::Gunzip to get the uncompressed content. However I would like to do this transparently so that WWW::Mechanize methods like form(), links() etc work...

How do I get WWW::Mechanize to work?

This script: use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); $mech->get( "http://www.google.com" ); print $mech->content; Produces this error message: Error GETing http://www.google.com: Can't connect to www.google.com:80 (connect: Unknown error) at D:\PERL\try.pl line 5 Wh...

How do I use and debug WWW::Mechanize?

Hi guys, I am very new to Perl and i am learning on the fly while i try to automate some projects for work. So far its has been a lot of fun. I am working on generating a report for a customer. I can get this report from a web page i can access. First i will need to fill a form with my user name, password and choose a server from a dro...

How do I use Perl's LWP to log in to a web application?

I would like to write a script to login to a web application and then move to other parts of the application: use HTTP::Request::Common qw(POST); use LWP::UserAgent; use Data::Dumper; $ua = LWP::UserAgent->new(keep_alive=>1); my $req = POST "http://example.com:5002/index.php", [ user_name => 'username', user_password => "passwor...

How do I configure WWW::Mechanize to work through a proxy?

I sit behind a proxy and have HTTP and WWW::Mechanize working OK locally. But advice || pointers as to how to get through a proxy please. Regards Ian ...

How can I select a random listbox item with WWW::Mechanize?

With Perl's WWW::Mechanize module, I want to select a random value from a select box. How can I do this? With dump_forms I can dump select box values, but how can I get them in an array? ...

How do I download a file with WWW::Mechanize after it submits a form?

I have the code: #!/usr/bin/perl use strict; use WWW::Mechanize; my $url = 'http://divxsubtitles.net/page_subtitleinformation.php?ID=111292'; my $m = WWW::Mechanize->new(autocheck => 1); $m->get($url); $m->form_number(2); $m->click(); my $response = $m->res(); print $m->response->headers->as_string; It submits the download button on ...

Ruby - Socks4 proxy with WWW::Mechanize and NET::HTTP::GET

Hey, I searched on google and read in the ruby manuals, but I couldn't find a way to use WWW::Mechanize and NET::HTTP::GET over a socks4 proxy. I read, that WWW::Mechanize is a subclass of the UserAgent module, and that therefore the ->proxy() method would work. But the manual only talks about http, ftp and gopher proxy. Any ideas how ...

How can I add a progress bar to WWW::Mechanize?

I have the following code: $mech->get($someurl, ":content_file" => "$i.flv"); So I'm getting the contents of a url and saving it as an flv file. I'd like to print out every second or so how much of the download is remaining. Is there any way to accomplish this in WWW::Mechanize? ...

Managing HTTP Cookies on iPhone

Hi, I want to port a python app that uses mechanize for the iPhone. This app needs to login to a webpage and using the site cookie to go to other pages on that site to get some data. With my python app I was using mechanize for automatic cookie management. Is there something similar for Objective C that is portable to the iPhone? Than...

How can I get the frame source with Perl's WWW::Mechanize?

Using WWW::Mechanize::Firefox, I can get the source of the page I visited. However, if the page contains a frame, I get the frame tag and not the actual source of the page that is loaded. Mechanize::Frames seems to be what I am looking for. Is there a way to use them together? ...

Why can't WWW::Mechanize::Firefox locate it's "new" method?

I get the following error when I run the little sample script: Can't locate object method "new" via package "WWW::Mechanize::Firefox" (perhaps you forgot to load "WWW::Mechanize::Firefox"?) at mechtest.pl line 2. use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->get('http://google.com'); $mech->eval_in_pag...

How can I access forms without a name or id with Perl's WWW::Mechanize?

I am having problems with my Perl program. This program logs in to a specific web page and fills up the text area for the message and an input box for mobile numbers. Upon clicking the 'Send' button, the message will be sent to the specified number. I already got it to work for sending messages. But the problem is I can't make it work fo...

How can I download a file using WWW::Mechanize or any Perl module?

Is there a way in WWW::Mechanize or any Perl module to read on a file after accessing a website. For example, I clicked a button 'Receive', and a file (.txt) will appear containing a message. How will I be able to read the content? Answers are very much appreciated.. I've been working on this for days,, Also, I tried all the possibilitie...

Why does WWW::Mechanize and login-data break when I switch from a query string to a hash?

Hello! The following script works fine: #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use WWW::Mechanize; my $loginData = "userName=username&password=password&deeplinkForward=%2Fselfcare%2Frestricted%2FprepareCoCo.do&x=84&y=7"; my $loginUrl = "https://www.login.login/login.do"; my $mech = WWW::Mechanize->new( show_pro...

How can I make WWW:Mechanize to not fetch pages twice?

I have a web scraping application, written in OO Perl. There's single WWW::Mechanize object used in the app. How can I make it to not fetch the same URL twice, i.e. make the second get() with the same URL no-op: my $mech = WWW::Mechanize->new(); my $url = 'http:://google.com'; $mech->get( $url ); # first time, fetch $mech->get( $url ...