Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: how to troubleshoot a http::request 404 problem

by Your Mother (Chancellor)
on Feb 19, 2011 at 23:31 UTC ( #889121=note: print w/ replies, xml ) Need Help??


in reply to how to troubleshoot a http::request 404 problem

Broken code could cause it. :) This works fine–

use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $wetter = "http://www.peng.es/wetter/wetter.txt"; my $response = $ua->request( HTTP::Request->new('GET' => $wetter ) ); print $response->decoded_content, $/ __END__ <div align="center"><strong><span class="temp">15.3&deg;C</span></stro +ng> <span class="resttemp">(59.5&deg;F)<br><font size="-2">23:25 - 19 + Feb 2011</font></span></div>

When you have questions, you should post the exact code you’re running. What you posted doesn’t even create the UserAgent. Also, use strict and warnings, always.

Update: WWW::Mechanize will make all this stuff more pleasant.


Comment on Re: how to troubleshoot a http::request 404 problem
Download Code
Re^2: how to troubleshoot a http::request 404 problem
by lexthoonen (Initiate) on Feb 23, 2011 at 08:27 UTC

    First of all, thanks for your answer, however, my result with your code is:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /wetter/wetter.txt was not found on this server.< +/p> <hr> <address>Apache/2.2.3 (CentOS) Server at www.peng.es Port 80</address> </body></html>

    Strange, no?

      hmmm, that makes me think (at last...). I'll report back.

        well thanks to all of you, I now know the real problem wasn't in the code. It's a server thing; if i ping www.peng.es from the server that runs that piece of code, I get:

        ping www.peng.es
        PING www.peng.es.nl (212.78.185.192) 56(84) bytes of data.

        well, that peng.es.nl is weird and the ip is wrong too: should be 213.171.223.35

        So, I now know I look into that direction.

        Thanks, to all of you!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889121]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-07-07 07:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls