April 25th, 2000, 05:19 AM
I would like to make a php3 file being visited every minute.
The php3 file is done
The cron file is not the problem.
Making a perl.cgi visiting the php3 file is.
I know about php3-cgi or lynx, but both sollutions aren't 'nice', every minute starting lynx neh. php3-cgi is being removed. I know I am not the only one with this problem, but it seems I cannot find the solution.
You have to do some pretty smart Perl socket programming there. Check out Graham Barr's Net Libraries at CPAN, there is some functionality that should be able to help you retrieve a web page (your PHP script).
So you can cron a perl script...
PHP, Perl, SQL Programming at http://www.mentalobjects.com
Ok, I found the answer, at least it works on my server.
You need to install some perl modules. Thanx to the one sending me the code. Forgot his name lost his mail.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
my $url = shift;
$url = URI::URL::url($url, "http://somehost/somephppage")->abs;
my $ua = new LWP::UserAgent;
my $request = new HTTP::Request('GET', $url);
my $res = $ua->request($request);
my $result = ($res->is_success)?$res->content:$res->error_as_HTML;
$result = $1 if $result =~ /<BODY.*?>(.*?)</BODY>/si;
$result =~ s/(<IMG.*?SRC="?)(.*?)([" >])/$1.URI::URL::url($2, $url)->abs.$3/gies;
$result =~ s/(<A.*?HREF="?)(.*?)([" >])/$1.URI::URL::url($2, $url)->abs.$3/gies;
yes I did, but I had some problems with the write permissions, nevertheless I am sure that one works fine
My bad. I shouldn't use /tmp directory as an example.
$local_dir = "/tmp/grabbed_data";
If you hack the Simple.pm further, you will see $modified_time gives you a value under =item head($url).