The type of response that you are going to get is the webpage source code - that's the code that your browser would run to present the user display. The LWP family of routines essentially emulates a browser (the server cannot tell the difference). So,
my $response = $ua->get('http://sentimentanalyzer.appspot.com');
would suffice for that purpose. This "input=>te" means nothing. In order to send a response to this server, you need to use the POST method to send your text back (based upon the received webpage) and specify the action. This will have the effect of clicking on the "submit" button.

While looking at this page, I learned of this "curl" freeware program. They give an example of how to use it with their page. That looks pretty straight-forward to me for this simple application. But I have never used Curl.

If this is all you need to do, I would follow their suggestion and use this freeware Curl thing. I've written a number of these LWP programs and often spent hours or even days figuring out the right "incantation".

Anyway, if you just need this one website's function, I would install and run Curl, my $result = `curl ...whatever...` . Get that working, then tackle a more general solution with Perl's various LWP methods including of course LWP and Mechanize - this can get very complicated!

I would concentrate on making your first Perl web program a success rather than having to know/learn a lot of sophisticated stuff that is not necessary for the job at hand.

Update: Just tried this advice, and although it sounded good from the website, their main mirror site is having troubles now and I was unable to download a "unzip and go, i.e. a pre-built" Windows version of this thing. So evidently this may take more work than the main website claims.


In reply to Re: Passing Values to a webpage and retrieving an answer by Marshall
in thread Passing Values to a webpage and retrieving an answer by nateg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.