I couldn't get any meta data to print.
This script works and and it seems to honor the timeout:
#!/usr/bin/perl
#use strict;
use LWP::Simple qw($ua get);
use HTML::HeadParser;
# use HTTP::Status;
$ua->timeout(10);
open (OUTFILE, '>outfile.txt');
open (MYFILE, 'url4.txt');
foreach $line...
Can't figure it out. I thought maybe it had something to do with the sequence of the script, changed that a bit, but didn't help. The code:
$head->parse("$response");
foreach (keys %{$head->header()}) {
print "$_\n";
}
produces no results.
Have you tried testing this on your end with...
Thank, Chris for your help and patience. Yes, the $url (print "$url\n") does indeed print out the successfully connected URLs.
My purpose in the script, although it may not have been obvious as I am a newbie as I'm sure you know by now and just learning, was to extract the meta-keywords from...
the line:
next unless ($response->is_success);
would that make it NOT go to the next line upon success?
It needs to jump to the next line if NOT success.
The original script, given a list of URLs from url3.txt, one per line, printed out the meta-description of the website for each line.
That worked. Using your script and the same input file url3.txt, I'm getting a string of dots.....
Your last correction stopped url3.txt from being wiped out but the outfile.txt only contains a string of period marks like this:
....................
about that many.
Hmmmm....
Thank you. I see the logic and understand the flow, but am having difficulty seeing where that code fits into my original code. I'm presuming there must be some changes needed to my original code for the new variable. Is that right?
I'm learning.
Thank you.
thanks for the information on LWP::UserAgent, I see that the is_success parameter will help me determine if I have a page. The problem I'm grappling with now is how to enumerate through the list such that when is_success fails, the foreach goes to the next line in the file. I'm stumped on...
I have the following perl script which works nicely - it imports a list of urls, goes out to them, grabs the Head data and writes it to a file. Problem is, if it encounters a domain that is unresponsive or takes long to load, it halts and just sits there. I'm wondering if there is a way to make...
What is the best method to delay all outbound email using postfix on linux?
I've tried smtp_destination_rate_delay but will please someone tell me if this can only be used for mail destined to specific domains or any domain?
Thanks in advance.
Hello, and thanks for letting me in!
Okay, I'me a pretty avid reader of the O'reilly series of Hack Books, but it seems that I've been coming across more and more errors in their perl scripts as I continue to read. I've attached below a perl script written by the author of "Linux Server...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.