Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Fetching an Image from HTTP

by aaron_baugher (Curate)
on Apr 07, 2012 at 10:57 UTC ( [id://963906]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Fetching an Image from HTTP
in thread Fetching an Image from HTTP

Since you're reading your URLs from a text file, each one has a newline on the end of it. There may be other problems with them. So you're requesting bad URLs from the server, and it's sending back an information page to tell you that, hence the "Website Moved" title of the HTML page you're getting back. Load the page you get back in a web browser (you might want to rename it to something.html first) to see what it's trying to tell you. (The same newline issue will cause weirdness with the local filenames you're saving to as well.)

Inspect the actual URL you're requesting, right before requesting it, with a line like the following, and you should see the problem:

print qq[ '$url' ];

Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.

Replies are listed 'Best First'.
Re^4: Fetching an Image from HTTP
by Aldebaran (Curate) on Apr 09, 2012 at 05:21 UTC

    thanks so much, aaron, that got me over the hump. I mistakenly posted on this thread that looked similar to mine, which I was using as a reference. The original node is here: http://www.perlmonks.org/?node_id=963858 . I'd like to clean this up yet by, for example using WWW::Mechanize correctly as well as chomp, but I'll try to solicit comment back on the original.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found