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.)
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.