Python, PHP or what scripting language is the best for automating web-interaction tasks?

I wonder what is the best scripting language for doing the following:

I go to this website

and the input a two lines string like:


Afterwards I push the "Make NA" button, so I download the resulting file, which I change the name before downloading it.

I would like to do this for 10000 different input strings, so I easily download the resulting files (with different names).

I wonder what is the best web-scripting (is it the right name?) language for this purpose in order to start to study this in deep. I read something about python, while other people think PHP or Ruby are much better. I just would like to know the most friendly (while useful for my purposes) one.

Also some hints for the implementation of this idea would be appreciated.

Thanks in advance


The most general answer would be: use the language you already know well. If you don't know any language, pick one to learn (this decision should be made based on more complex criteria than just this task) and then use it for the task.

Personally I would use Python with the mechanize module.

Also, on a subjective note, if you're unfamiliar with neither Python or PHP, definitely pick Python. It has a far more general use than PHP, and generally is a better language to start programming with.

Actually the language matters very little. You can use curl in either python or PHP and get the job done. I have written a complex webform automation script using curl in both python and PHP. Heck you could do it from the command line if you are comfortable there and then just put together a batch file or script.


The Mechanize library is available for Perl, Python, and Ruby, but not (publicly) for PHP. Perl is the original, and Ruby is the only one I've used, so the only one I can wholeheartedly recommend. It will do almost anything you want to do, and it works well with Nokogiri, which is an awesome parsing library for HTML, XML, etc. (In fact it not only works well with Nokogiri, but it uses Nokogiri internally, so you'll definitely have all of Nokogiri available to you.)

There is one shortcoming, though. If you need to log into a site, and the site uses session-based authentication, and the session cookie is set by JavaScript that runs in the browser (rather than HTTP headers), then AFAIK there's no way to do this with Mechanize.

In Ruby you have several other options, such as Capybara & Selenium (which can drive Firefox, Chrome, IE, and possibly Safari too). Actually automating a browser will be slower than using Mechanize, but it will allow certain things that appear to be impossible with Mechanize.

You could also look into use PhantomJS and CasperJS. Because they are written in JavaScript, the issue of running JavaScript to set a session cookie should not be a problem.

So in short, I would choose either Ruby or JavaScript as the language, and then one of the options above, depending on your needs.

Need Your Help

sql server 2000 error, error trying to connect to sql server 2005

sql sql-server-2005 sql-server-2000

i am connecting to sql server 2000 on a remote computer with a dotnet application, but when i try to open the connection it gives the following error: