Run/Execute URLs in a queue?

Discussion in 'Programming' started by JSalvador, Nov 10, 2007.

  1. #1
    Hi,

    I have a list of links to scripts that need to be run as a queue. And I'm looking for a solution to do this. I know that is might sound pretty simple but I'm a pretty big greenhorn when it comes to this. So here's how it needs to be done...

    Execute http://www.link1.com
    [pause 5 mins]
    Execute http://www.link2.com
    [pause 5 mins]
    Execute http://www.link3.com
    etc...

    I know this probably isn't the best way to do it... but that's how it was set up. There are a couple hundred urls that need to be executed... So I'd hate to have to write up a script and code all of them in by hand. Is there a solution that I could drop in a list of URLs set a time between to execute them then let it run?

    Thanks
     
    JSalvador, Nov 10, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php
    
    set_time_limit(0);
    
    $links = file('links.txt');
    
    foreach ($links AS $link)
    {
        file_get_contents(trim($link));
        sleep(300);
    }
    
    ?>
    
    PHP:
    If PHP is okay for you.

    This script expects that there's only one URL in each line of the text file.
     
    nico_swd, Nov 10, 2007 IP
  3. JSalvador

    JSalvador Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    JSalvador, Nov 10, 2007 IP
  4. SolomonZhang

    SolomonZhang Peon

    Messages:
    523
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That basically means you are trying to access pages located in a password protected directory. If you are not, try to contact your hosting support and ask them about this.

    If you do put the pages in password protected folder, there are 2 solutions:
    1. You put them in a non protected folder. If you are unwilling, then...
    2. You read them via CURL function of PHP (confirm your hosting whether they support CURL for PHP). Then search Google for CURL usage. Not really complicated if your protection system is simple.
     
    SolomonZhang, Nov 11, 2007 IP