cztmonk has asked for the wisdom of the Perl Monks concerning the following question:

I try to translate words from english to dutch, using a website (van dale). I use LWP:simple to fetch the url. This works fine.Can anyone tell me which next steps to make?

#!/usr/bin/perl -w use strict; use LWP::Simple; my $html = get "http://www.vandale.nl/opzoeken?pattern=Fetch&lang=en"; die "Couldn't get it!" unless defined $html; print $html;

Replies are listed 'Best First'.
Re: lwp::simple question
by Corion (Patriarch) on Jul 19, 2012 at 12:57 UTC

    What would you do as a human? Write down these steps. Then translate each of your steps into Perl.

    Assuming that you would read some text on the returned HTML page, maybe you want to extract some text from the HTML? See among many others Web::Scraper, Web::Magic, Mojolicious and App::scrape.

Re: lwp::simple question
by zentara (Cardinal) on Jul 19, 2012 at 13:00 UTC
Re: lwp::simple question
by marto (Cardinal) on Jul 19, 2012 at 14:19 UTC

    I don't understand Dutch ("it's all Dutch to me"), but you may want to check their terms or service/usage as automating this service may be in violation of them. The reason I suggested using such services via an API (Re^4: vandale.pl) is that this allows them to control access (and resources they require) for the services which cost them money to run. Hence Google/Microsoft offering a proper API.

      Thank you guys for all the advice. Have a nice weekend.

Re: lwp::simple question
by daxim (Curate) on Jul 19, 2012 at 12:59 UTC
    You want to parse the HTML for the results.
    use Web::Query 'wq'; my $translation = wq($html)->find('#content-area span')->first->text;