#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    In nederland
    Posts
    41
    Rep Power
    15
    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    43
    Rep 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
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    In nederland
    Posts
    41
    Rep Power
    15
    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]
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Have you read this one I posted? http://www.devshed.com/Talk/Forums/F...ML/000136.html
    Well, as long as you got yours running, that is fine.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    In nederland
    Posts
    41
    Rep Power
    15
    yes I did, but I had some problems with the write permissions, nevertheless I am sure that one works fine
  10. #6
  11. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    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).

Similar Threads

  1. Replies: 4
    Last Post: April 23rd, 2004, 10:18 AM
  2. 2 part OUTPUT HTML
    By tiger_1234 in forum Perl Programming
    Replies: 3
    Last Post: February 10th, 2004, 04:15 PM

IMN logo majestic logo threadwatch logo seochat tools logo