that was my first tack, and I thought I was on the right track, but what I ended up with using getstore() was files that kind of thought they were jpg's and kind of thought they were html docs. Here's the script I used:
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
open FILE, "text1.txt" or die $!;
my $url;
my $text;
while (<FILE>)
{
$text = $_;
$url = 'http://www.nobeliefs.com/nazis/' . $text;
$text =~ s#images/##;
print "$url\n";
print "$text\n";
getstore($url, $text) or die "Can't download: $@\n";
}
an ls command shows question marks:
$ ls
...
prayingHitler.jpg?
PraysingCelebration.jpg?
priests-salute.jpg?
received.jpg
reichchurch.gif?
...
and when I open up a jpg it looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/
+/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Website Moved</title>
<style type="text/css">
.statusBox {
width: 80px;
}
.fb {
width:43%;
float:left;
text-align:center;
margin:5px 20px 5px 20px;
padding:20px 0 20px 0px;
background:#eef8fd;
height:110px;
border:solid 1px #dff4fe;
}
.fb2 {
width:43%;
float:right;
text-align:center;
margin:5px 20px 5px 20px;
padding:20px 0 20px 0px;
background:#eef8fd;
height:110px;
border:solid 1px #dff4fe;
...
I think the trick might be to find a way to define $params such that this works, but I haven't been able to do that yet. (I only get errors)
my $data = LWP::Simple::get $params{URL};
my $filename = "image.jpg";
open (FH, ">$filename");
binmode (FH);
print FH $data;
close (FH);
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.