SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I have a couple of PHP problems that I can't seem to solve.

    1) Is it possible to run a script when a new email comes into a mailbox? Maybe a trip or flag is set so that the php script runs.

    2) Alternatively, can i put a PHP script into a cron job?
    What form must the php script be in to work in a cron. I take it you cant have any web based headers etc being returned as it will be running under a unix shell.

    Sorry if I sound dumb, all help is appricaited.

    Best regards SD,
    http://www.e-tones.co.uk - FREE Resources for your mobile phone

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2000
    Location
    Warwickshire, England
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can easily run PHP scripts as a program with cron, just set the cron job to execute command "/path/to/php/binary /path/to/file.php"

    You can have web headers etc and echo(), print() etc.. but there is no point.
    It may be useful for debug purposes, otherwise you may as well delete them out of your scripts (the echo(), print(), printf() etc)..

    As far as email is concerned, I guess this could be a setting with your email server to execute programs on new mail?

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply.

    I already have a system when orders are sent via email and a php application gets the emails, parses them out and puts the correct data into a mysql database.

    However, to do this I have to login to my web based control panel and click a button, the script must run in a web browser.

    Currently this system works fine. However, we will be upgrading our services (we are an sms logo/ringtones site) so that users can send ringtones / logos directly to their phones. I want the process to run say every 10 minutes so that a users order is with them in a very short space of time.

    The process goes like this:

    1) The user makes a product choice.
    2) They ring a telephone number
    3) An order email in a generic format is sent to our system ready to be picked up and processed.
    4) The order is processed and sent to the user automatically.

    Now, I can do all of this BUT like I said, i have to be logged into the control panel and do it via a web based system. This means that unless im logged in, users cant be sent orders and have to wait until i return. And I have a full time job, so I cant really do this

    Therefore, i though to put everything into a cron tab, however I cant as I get many errors. I can have any print or echo statements, however the SMS server I use to send orders sends back http headers depending on if the sms has been sent etc etc. How can I over come this problem?

    I have a dedicted server. I was thinking (and well, its a crap idea but it might work ) to launch a web browser on the server terminal, the http page loaded could then simply refresh every 10 minutes. This would allow me to over come these problems, however it seems like a very bad way of going about things,

    I look forward to your replies.
    http://www.e-tones.co.uk - FREE Resources for your mobile phone


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
  •