dpymrcl269187540 2012-03-09 04:22
浏览 74

带有http回调的IMAP IDLE监控服务?

I have a small web app which polls an IMAP mailbox (via PHP's imap module) every minute via a cronjob. I'd like to make this more realtime, as the maximum 1 minute lag is unacceptable in some cases.

Is there a service out there that will connect to an IMAP mailbox, use IMAP IDLE to constantly monitor for messages, then POST exhaustive message data (headers, content) to a URL? Sort of like Twilio does with incoming phone calls?

  • 写回答

1条回答 默认 最新

  • dongpao5658 2012-03-09 04:37
    关注

    I don't know of a service that you describe, but I suggest simply turning the script you already have into a daemon.

    If you wanted, you could do this yourself using the PCNTL extension. Instead, I utilize a class that has everything all set up and ready to go:

    http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/

    Using that class, you can create a "daemonized" version of your script fairly easily:

    require_once "System/Daemon.php";                 // Include the Class
    System_Daemon::setOption("appName", "mydaemon");  // Minimum configuration
    System_Daemon::start();                           // Spawn Deamon!
    

    (Sample code from the page with the daemon class)

    评论

报告相同问题?