in reply to Passing Values to a webpage and retrieving an answer

So, how did your code fail for you? What exact code did you use? Please post a small, self-contained example that reproduces the problem. The code you've shown does not tell us what modules you are using. It helps us to help you better if you show us a short but complete program and tell us what output you get and what output you expect.

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

Replies are listed 'Best First'.
Re^2: Passing Values to a webpage and retrieving an answer
by nateg (Initiate) on Apr 30, 2012 at 22:12 UTC

    I tried using www:Mechanize to do it (after searching the web). What i have so far is:

    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) { #In here i want to retrieve a value from the site after # inserting the text and hitting the "submit" button. }

    The textarea in the site is named "input".

    I also didn't figure out how to activate the button..

      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.

        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?