in reply to Downloading PHP-generated images using the LWP::UserAgent and WWW::Mechanize modules

My problem is that when I downloaded an image, Linux (Ubuntu distr.) doesn't recognizes it as an image

Linux is not an image viewer - how exactly did you try to open it? What's the output of file $image.jpg (use a real image name)?

My guess is that your regex doesn't work as you expect it to, $1 contains an invalid URL and you get an error page mirrored.

Did you try to print the matched URLs to STDOUT?

And try this regex:

$content =~ m{<tr><td><img src="([^"]+)" alt="php-image" /></td></tr>}

  • Comment on Re: Downloading PHP-generated images using the LWP::UserAgent and WWW::Mechanize modules
  • Select or Download Code