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

So, where in that script do you use WWW::Mechanize?

Also, again, please do post a complete script, together with the output you get and the output you expect. The script you posted above does not run, because it does not load any of the needed modules.

  • Comment on Re^3: Passing Values to a webpage and retrieving an answer

Replies are listed 'Best First'.
Re^4: Passing Values to a webpage and retrieving an answer
by nateg (Initiate) on May 01, 2012 at 00:12 UTC

    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?

      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.