Script to control other scripts...

Discussion in 'PHP' started by redhits, Nov 9, 2009.

  1. #1
    What i want to do is simple to understand.
    I have around 4 scripts, that takes 4-10 minutes ++ for each of them to complete (to search into a database, update a database). All of those 4 scripts are running on 4 different servers.

    I want to create an php script, that will be able to do open all of those 4 scripts, and control them. Keep them running at the same time, when he read the results to send a new POST command,etc.

    How i can do this? I know that PHP do not support multitasking... and i want to keep all 4 sites opened at the same time, have a while cicle..etc...

    reading site by site...will just be a terror..
     
    redhits, Nov 9, 2009 IP
  2. Entherman

    Entherman Peon

    Messages:
    173
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not sure if I understand what you need, but you might try curl ? (if scripts are executed via url ....)
    Or CRON ?
     
    Entherman, Nov 9, 2009 IP
  3. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #3
    Calling them via CURL is not a problem ...

    The problem is this, i need 1 single script controlling 4 external urls at the same time (both of those 4 urls are on different servers)
    I just need to push some POST to them. If i call them with curl, i need to wait until the webpage loaded complete after that to call the next url , i would like to open all 4 urls at the same time,
    like when you open 4 slow websites in your firefox , each of them in a new tab... and you wait for all 4 to load..
     
    redhits, Nov 9, 2009 IP
  4. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Not really.

    You can use CURL asychrnonusly, meaning you can make a HTTP request with POST data and just continue executing the script - this isn't exactly controlling, its more of just triggering something and continuing.

    If this is ok with you and its what you need then have a look here on how to do this.
     
    ShadyStudent, Nov 9, 2009 IP
  5. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #5
    What do i need to install on my server for multi_curl to work? curl is enough ? do i need to install anything else?
     
    redhits, Nov 9, 2009 IP
  6. Entherman

    Entherman Peon

    Messages:
    173
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Pay a visit :)
    php.net/curl_multi_exec
     
    Entherman, Nov 10, 2009 IP