I'm working on the same problem for my wife: pull down the daily Monty strip.

I'm trying a paired down version of code (found here) and then altered to send it to her inbox. Thing is, the script only works about 1/5th of the time. The other four times it delievers nothing, or an old image.

I'm not sure if it's because the regexp I'm doing is off, or if the site has a way of knowing I'm doing an image pull like this.

At any rate, I'm hoping to get it solved today. I'm working towards building a search agent in perl, and this is one of my first steps.

Here's the code I'm using:
#! /usr/bin/perl -w #use LWP::Simple; #$url = "http://www.unitedmedia.com/comics/monty/"; #$url = get($url); #$url =~ /<img src=\"\/comics\/monty\/archive\/images\/(monty\d+\.gif) +\"/; #getstore("http://www.unitedmedia.com/comics/monty/archive/images/$1", +"../$1"); #$url = "http://www.unitedmedia.com/comics/monty/archive/images/$1"; #print $url; #send_mail('emailaddy@here.com', 'sender@here.com', 'Your comic', $url +); # #sub send_mail { # my($to, $from, $subject, $body)=@_; # my $sendmail="/usr/lib/sendmail -t"; # open (MAIL, "|$sendmail") || die "Can't start sendmail: $!"; # print MAIL<<END_OF_HEADER; #From: $from; #To: $to; #Subject: $subject; # #END_OF_HEADER # foreach ($url) { # print MAIL "$_\n"; # } # close(MAIL); #}

In reply to Re: Broken Dilbert archive script using LWP::Simple by mazingerz
in thread Broken Dilbert archive script using LWP::Simple by beowulf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.