in reply to Re^3: Passing Values to a webpage and retrieving an answer
in thread Passing Values to a webpage and retrieving an answer

My mistake, didn't use Mechanize.

My code is -

require HTTP::Request; require LWP::UserAgent; use HTTP::Request::Common; print "hallo\n"; my $ua = LWP::UserAgent->new; $ua->env_proxy; $te='hallo hallo hallo'; print $te; my $response = $ua->get('http://sentimentanalyzer.appspot.com','in +put'=>$te); if ($response->is_success) { print "seccess\n"; $page=$response->content; print $page; }

I wanted to print the content of the response to see what i am getting but it was the original url HTML code. I can't pass the text to the text area or activate the button (at least it doesn't show in the response content). How can i make it work and get a specific value from it?

Replies are listed 'Best First'.
Re^5: Passing Values to a webpage and retrieving an answer
by Corion (Patriarch) on May 01, 2012 at 08:24 UTC

    If you want to behave like a browser, I recommend using WWW::Mechanize. Otherwise, you will have to know what the target page for the form action is, and whether it takes a GET request or a POST request. Then you have to create the POST requests yourself. See HTTP::Request::Common, and use it.

    Usually, WWW::Mechanize takes care of all those steps for you, which is why I prefer it.