Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

LWP::UserAgent Mystery

by Anonymous Monk
on Oct 17, 2007 at 01:17 UTC ( #645340=perlquestion: print w/replies, xml ) Need Help??

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

Having been rudely told to correct my script despite having told my webhost it has been working for ages, I want to ask experts on here for clues.

This has been working for ages:

use LWP::Simple; use LWP::UserAgent; use Data::Dumper; use XML::Simple; my $ua = new LWP::UserAgent; my $response = $ua->get($xmlurl); my $xmlString = $response->content; my @options = (); my $ref = XMLin($xmlString, @options); print Dumper($ref);

where $xmlurl is a valid XML file.

Now this has been working for a while and suddenly I get nothing back in the dump. But If I simply put the script on another subdomain, it works perfectly.

Whar could be going wrong here?

Thanks in advance

BTW, the size of the XML file is small. I did have a problem the other day with a massive file but am no longer using that XML file obviously.

Replies are listed 'Best First'.
Re: LWP::UserAgent Mystery
by Herkum (Parson) on Oct 17, 2007 at 09:23 UTC

    Do a Dump on the $xmlString instead of the result. I am willing to bet that the document that you are requesting is either,

    1. Invalid XML
    2. You are not getting a document back.
    If you are not getting a document back, it might have to do with where your script is located. It might not be able to reach the URL from the server that it is installed on( stuff happens ).
      Thanks for the replies...

      it was the webhost blocking outgoing connections, I knew it! I'm so annoyed.
      Looks like I was talking to a junior member of support who was guessing all sorts.
      An expert took over and told me it was a server problem blocking outgoing connections (what a surprise)which is being resolved.

      For info, the error message I got was

      500 Can't connect to somedomain:80 (connect: No route to host)

      so imagine how I felt when the junior told me I had my outgoing connection blocked due to terms and conditions abuse (incorrect)!!
      Anyway, I'm talking to someone who knows what they're doing now...
Re: LWP::UserAgent Mystery
by TOD (Friar) on Oct 17, 2007 at 01:41 UTC
    change your webhost.
    masses are the opiate for religion.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://645340]
Approved by tye
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2023-09-24 07:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found