in reply to Post and get

Wel,

I adopted Lhowards code and took mine and adjusted a bit ...
my $WWWAgent = new LWP::UserAgent(); my $site=new URI::URL 'http://translate/lhsl.com/greenacres.dll?text=$ +text&pair=$pair&domain=$domain&interface=$interface'; # Create a request my $WWWRequest = new HTTP::Request 'GET',$site->as_string(); # Pass request to the user agent and get a response back my $WWWResult = $WWWAgent->request($WWWRequest);


Well got the same problem with my code and this code.
When I use cgi.pm to display $WWWResult I get ; HTTP::Response=HASH(0x833dd4c)


This error(in the error.log from apache) I get when using completely Lhowards code:
Error submitting form HTTP::Response=HASH(0x82bd790)->code HTTP::Response=HASH(0x82bd790)->message at /home/geert/www/cgi-bin/translate.cgi line 31.


--
My opinions may have changed,
but not the fact that I am right

Replies are listed 'Best First'.
RE: Re: Post and get
by lhoward (Vicar) on Jul 03, 2000 at 19:41 UTC
    I see 2 problems with your adapted version of my example:

    1. You shoul use query_form to encode the request as I did in my example. If you do not, you will have to worry about handling special characters (like spaces) in the request yourself.

    my $site=new URI::URL 'http://translate/lhsl.com/greenacres.dll';
    $site->query_form(text=>$text, pair =>$pair, domain=>$domain, interface=>$interface);

    2. $WWWresult is not the text returned by LWP; it is an HTTP::Response object. The object contains the page conent (in $WWWresponse->content) in addition to any LWP errors, etc...

      Thanx...

      That's why I come to PM. I'm always browsing CPAN, but not always understanding the manuals or overlookings something and then there are people at PM who can guide me and see the light.

      My problem is that sometimes I don't understand objects good enough to know exectly what I'm doing :-)

      But I'm learning!!!!
      --
      My opinions may have changed,
      but not the fact that I am right