How to run a code after XX seconds?

Discussion in 'PHP' started by kuser, Mar 5, 2013.

  1. #1
    The pimpliest problem is i wish to load a code after XX seconds, the biggest problem is that i don't really wish to run the sleep function. Why not?

    The software should auto post some news on my twitter account, and it will be a pain in the ... to calculate how much sleep after each executed job.

    I would like to do soemthing like
    [/code]
    twett($account1,$password,$messange1,IN_HOW_MANY_SECONDS1);
    twett($account2,$password,$messange2,IN_HOW_MANY_SECONDS2);
    twett($account3,$password,$messange3,IN_HOW_MANY_SECONDS3);
    twett($account4,$password,$messange4,IN_HOW_MANY_SECONDS4);
    twett($account5,$password,$messange5,IN_HOW_MANY_SECONDS5);
    [/code]
    The sleep function will really not work for me!
     
    kuser, Mar 5, 2013 IP
  2. Dark Arts

    Dark Arts Greenhorn

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    Sorry if I'm not understanding why sleep will not work for you. Maybe would it work better to make a cron instead?
     
    Dark Arts, Mar 5, 2013 IP
  3. D3Tek

    D3Tek Active Member

    Messages:
    164
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    50
    #3
    I'm not sure why the sleep function will not work for you either? Maybe use the function time_sleep_until()
     
    D3Tek, Mar 6, 2013 IP
  4. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #4
    Or if timing is THAT crucial, write a script to time how long the tweet takes and sleep xxx-time taken.
     
    Einheijar, Mar 6, 2013 IP
  5. dixcoder

    dixcoder Member

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    26
    #5
    there is a sleep() function in php try that one
     
    dixcoder, Mar 6, 2013 IP