Using the following code:
use LWP::Simple;
my $url= "http://example.com";
my $html= get $url;
I am able to get the source in $html variable, and when I echo out the variable, it does have the code. I am wondering how would I save one of the images on that page to my folder called images in the same folder where this file is now? I am getting to that page through my $IE->Navigate($url); method.
I tried using Image::Grab module, but it wouldn’t install without force (no idea how to do that).
First, parse the HTML using an appropriate module (I tend towards HTML::TreeBuilder::XPath).
Second, use its API to find the
<img>element you care about and extract its URI.Third, convert that URI to an absolute one with URI if needed.
Fourth, use the
getstoremethod from LWP::Simple to save it.