SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got a script that leech the wheater from another site, this works fine, but it makes my site pretty hard to load...
    Now, I want that php script writes the content of the leeched site to a file and that script has to update that file every hour...
    How do I do this?

    I'm using this now:
    PHP Code:
    <?
    $open 
    fopen("http://www.asite.com/index.php""r");
    $content fread($open1500);
    fclose($open);
    $search eregi("&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;&shy;(.*)Nieuw:"$content$begin);
    echo
    "$begin[1]";
    ?>

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would say the ebst way to do thast would be to set up a cron job and run the script through the php binary. Basically make the cron job run a script every hour that grabs the data from the weather site and writes it to a text file, then call that text file when you want to display it. If you need the code jsut ask.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A cron job?
    I'm hiring an apache webserver, i don't know anything about cron jobs...
    would you explain a cron job an give a url with more information?
    thanx

  4. #4
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can somebody help me pleaze....

  5. #5
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cron is the *nix clock daemon that executes commands at specified dates and times. You could use lynx to dump the data with the following:

    0 * * * * lynx -dump http://some.domain.com/page.php

    If PHP is compiled as an interpreter, you could use the following:

    0 * * * * php somepage.php

    And that somepage.php would get the data from the weather site and save it locally.. FreddyDoesPHP could probably help you out with that better than I can

    From the man page for cron:
    A crontab file consists of lines of six fields each. The fields are separated by spaces or tabs. The first five are integer patterns that specify the following:

    minute (0-59),
    hour (0-23),
    day of the month (1-31),
    month of the year (1-12),
    day of the week (0-6 with 0=Sunday).

    Each of these patterns may be either an asterisk (meaning all legal values) or a list of elements separated by commas.

  6. #6
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, but how do I use it???
    - htaccess files?
    i don't know...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •