The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
cron->perl->php3 need help on the perl part.
Discuss cron->perl->php3 need help on the perl part. in the PHP Development forum on Dev Shed. cron->perl->php3 need help on the perl part. PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 25th, 2000, 05:19 AM
|
|
Contributing User
|
|
Join Date: Apr 2000
Location: In nederland
Posts: 41
Time spent in forums: 40 m 2 sec
Reputation Power: 14
|
|
|
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.
greeting Jochum
|

May 3rd, 2000, 10:52 PM
|
|
Contributing User
|
|
Join Date: May 2000
Posts: 43
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
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
|

May 4th, 2000, 03:57 AM
|
|
Contributing User
|
|
Join Date: Apr 2000
Location: In nederland
Posts: 41
Time spent in forums: 40 m 2 sec
Reputation Power: 14
|
|
|
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>
#!/usr/bin/perl
my $url = shift;
$url = URI::URL::url($url, "http://somehost/somephppage")->abs;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use MIME::Base64;
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;
[/code]
|

May 4th, 2000, 04:29 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Have you read this one I posted? http://www.devshed.com/Talk/Forums/Forum6/HTML/000136.html
Well, as long as you got yours running, that is fine.
|

May 4th, 2000, 04:35 AM
|
|
Contributing User
|
|
Join Date: Apr 2000
Location: In nederland
Posts: 41
Time spent in forums: 40 m 2 sec
Reputation Power: 14
|
|
|
yes I did, but I had some problems with the write permissions, nevertheless I am sure that one works fine
|

May 4th, 2000, 05:12 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
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).
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|