SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to make php script run continously

    Hi,

    I have a requirement to keep checking a application, whether it is running or not.if it is running, echo one message, if not echo another message.

    eg:
    I have used new COM with skype4COM. I checked with isRunning. It returned false, i.e skype is not running. I displayed a messaged stating "You are offline". Now when the user starts skype, that message "You are offline" should be automatically turned to "You are online", the user should not refresh the page. So I think, I should use some timer.

    Kindly suggest with your ideas.

    thanks

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Either use a meta refresh to instruct the browser to periodically refresh the page, or use ajax to periodically check with a script on the server, and update the page.

  3. #3
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    its better to use ajax and maybe with cron jobs
    eYeew! Founder and Developer

    Madipta

  4. #4
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP is a great language but one thing it's NOT good for (simply because this is not what it was designed for) is being interactive and continuous.

    Few languages on the web are designed for this, because of the way that requests work: user clicks link -> browser requests page -> server parses script -> server sends page to browser -> browser displays page -> END.

    For this you want something dynamic. That would be JavaScript if you want compatibility, and possibly using AJAX to send a request to PHP to return their online status. Other possible solutions are applets such as Flash, Java and ActiveX.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


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
  •