Jaymac has asked for the wisdom of the Perl Monks concerning the following question:

I'm new to Perl and apparently clueless on web work. I'm trying to do something that should be dramatically simple (IMO) but has tied me up for an entire day so it's past time to ask questions.

I need to use an HTTP get with a token to retrieve a key for further queries to a particular web site.

Get Request:
GET /MyDataService/MyDataService.asmx/Authenticate?CustomerToken=string HTTP/1.1 Host: services.hjknet.com

Get Response:
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <string xmlns="https://services.hjknet.com/MyDataService/">string</string>

What I'm doing right now is to following:

###################################################################### +## W #!/usr/bin/perl -w use strict; use warnings 'all'; use LWP::Simple; use XML::Simple; my $url = 'http://services.hjknet.com/MyDataService/MyDataService.asmx +/Authenticate?CustomerToken=+NotMyRealToken== HTTP/1.1'; my $xml = new XML::Simple; my $xml_raw = get $url; my $inc_data = (); $inc_data = $xml->XMLin($xml_raw, SuppressEmpty => '' ); print "Inc_data: " . $inc_data . "\n"; print "Inc_data->{xmlns}: " . $inc_data->{xmlns} . "\n"; ###################################################################### +##

When I run this I get back (obfuscated...):
Inc_data: HASH(0x1ff9b88)
Inc_data->{xmlns}: https://services.hjknet.com/MyDataService/

I should be getting back a string that represents our key for other services. Any help or suggestions would be greatly appreciated. Please don't hit me too hard if I'm missing something dumb. Clearly I'm new to both Perl and LWP...

Thanks!

Replies are listed 'Best First'.
Re: Problem with simple LWP get request
by ikegami (Patriarch) on Aug 22, 2011 at 19:57 UTC

      Just gives me:

      Use of uninitialized value in concatenation (.) or string at ./test3.pl line 79. Inc_data->{content}:

Re: Problem with simple LWP get request
by Gangabass (Vicar) on Aug 23, 2011 at 01:44 UTC

    Remove ' HTTP/1.1' at the end of the $url

      I was not able to make a GET work beyond what I show here. I tried something similar with a POST and it worked... I guess I'll go with POST (though I'd rather know why GET didn't work...).

      Thanks to everyone for your help
        Then what was that you posted in the OP???