Questions tagged [www-mechanize]

WWW::Mechanize is a Perl module for programmatic web browsing, used for automating interaction with websites.

Features include:

  • All HTTP methods
  • High-level hyperlink and HTML form support, without having to parse HTML yourself
  • SSL support
  • Automatic cookies
  • Custom HTTP headers
  • Automatic handling of redirections
  • Proxies
  • HTTP authentication

Mech supports performing a sequence of page fetches including following links and submitting forms. Each fetched page is parsed and its links and forms are extracted. A link or a form can be selected, form fields can be filled and the next page can be fetched. Mech also stores a history of the URLs you've visited, which can be queried and revisited.

See the home page for complete details.

366 questions
34
votes
3 answers

Managing HTTP Cookies on iPhone

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…
dan
  • 5,377
  • 13
  • 39
  • 44
26
votes
9 answers

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…
davr
  • 18,877
  • 17
  • 76
  • 99
21
votes
5 answers

Scripts broke after upgrading LWP "certificate verify failed"

I have a lot of scripts, most of them based around WWW::Mechanize that scrape data off of misc hardware that is accessible via HTTPs. After upgrading most of my perl installation and its modules, all scripts using HTTPS:// broke because of…
Jarmund
  • 3,003
  • 4
  • 22
  • 45
16
votes
4 answers

Force www. and https in nginx.conf (SSL)

After purchasing a SSL certificate I have been trying to force all pages to secured https and to www. https://www.exampl.com is working and secure but only if type it in exactly. www.example.com or example.com are still pointing to http. We use…
Ender17
  • 163
  • 1
  • 1
  • 7
15
votes
2 answers

malformed header from script. Bad header=

I am receiving the following server error on a perl script: malformed header from script. Bad header=: youtube_perl.pl, Here is my source code: #!"C:\XAMPP\perl\bin\perl.exe" -T use strict; use warnings; use CGI; use CGI::Carp…
nicktendo
  • 681
  • 2
  • 11
  • 25
10
votes
2 answers

WWW::Mechanize and wide character warning

When I trying to download some HTML file with the code below: $mech->get($link) $mech->save_content("file.html"); I get the warning: Wide character in print at C:/strawberry/perl/site/lib/WWW/Mechanize.pm line 2040. Could someone explain how I can…
smith
  • 3,232
  • 26
  • 55
9
votes
2 answers

Perl WWW::Mechanize (or LWP) get redirect url

So I am using WWW::Mechanize to crawl sites. It works great, except if I request a url such as: http://www.levi.com/ I am redirected to: http://us.levi.com/home/index.jsp And for my script I need to know that this redirect took place and what the…
srchulo
  • 5,143
  • 4
  • 43
  • 72
8
votes
1 answer

How can I test a Dancer application with Test::WWW::Mechanize::PSGI?

I'm not sure on the right way to set up the script app for www mechanize. I did try at least one alternate that works, however I'm trying to pass in configuration with the test so I can make logging quieter with the test suite. #!/usr/bin/perl use…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
8
votes
4 answers

Is there a Node.js equivalent of Perl's WWW::Mechanize?

I'm searching a module for Node which would be similar to WWW::Mechanize for Perl. Or even better to WWW::Mechanize::Firefox. The main functionality would be to find and submit form by name, class or id. The ability to handle cookies would be…
Sami
  • 648
  • 8
  • 25
7
votes
4 answers

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.…
Suezy
  • 1,071
  • 4
  • 13
  • 19
7
votes
2 answers

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…
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
6
votes
1 answer

Incorrect filename on WWW::Mechanize submission

As far as I can read from the WWW::Mechanize documentation, you can do the following to submit a file from a string: $mech->submit_form( fields => { 'UploadedFile' => [[ undef, 'test2.txt', Content => $content ], 1], } ); This…
Sebastian Paaske Tørholm
  • 49,493
  • 11
  • 100
  • 118
6
votes
2 answers

Website log-in with Perl and Mechanize

So this is driving me crazy. Basically, when I hard-code my user name and password, I can log-in no problem. But I want to prompt the user to enter the username and password, as I would like to share this program with others. (the program is…
msikd65
  • 427
  • 1
  • 5
  • 11
6
votes
1 answer

How do I use WWW::Mechanize to check a radio box?

I am writing a Perl script to test certain parts of my webpage as I make changes to it. Using the WWW::Mechanize class, how can I select a radio box and submit a form?
jamesatha
  • 7,280
  • 14
  • 37
  • 54
6
votes
4 answers

How can I recover from a timeout with Perl's WWW::Mechanize?

I'm using WWW::Mechanize to read a particular webpage in a loop that runs every few seconds. Occasionally, the 'GET' times out and the script stops running. How can I recover from one such timeout such that it continues the loop and tries the 'GET'…
aks
  • 1,321
  • 5
  • 15
  • 27
1
2 3
24 25