From: "Alex Major" on
Greetings all,

I'm currently looking at building a web application, however I've run into
an area of development I've not come across before. The web site in its
basic form allows users to send cars from a point and then the car will
arrive at another point. When the car is set on its way, the start time,
travel duration and end time are all known and stored in a MySQL database,
what I would like to happen is that an event is triggered on the server at
the end time and then an e-mail is sent to the user. This should happen
regardless of whether someone is browsing the website or not.

I don't believe that I'll be able to solely use PHP, I have spent the
afternoon trying to look at potential solutions but I have to admit I've
drawn a blank. Google hasn't been helpful (64 pages so far), as any searches
related to "event handling" bring up a load of JavaScript tutorials/help for
'onclick' events etc. I have searched through the PHP documentation and
found "libevent" (http://www.php.net/manual/en/book.libevent.php ), I don't
believe that is what I require (although in all honesty the lack of
documentation on it means I'm quite in the dark as to its purpose). Another
potential candidate I came across was a PHP/Java bridge
(http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use the java
virtual machine, register events with it and then callback PHP scripts,
although this seems extremely long winded.

I was hoping that someone might have some experience with this kind of issue
and could point me in the right direction. I'm sure I've missed something
right in front of me.

Alex.

From: David Robley on
Alex Major wrote:

> Greetings all,
>
> I'm currently looking at building a web application, however I've run into
> an area of development I've not come across before. The web site in its
> basic form allows users to send cars from a point and then the car will
> arrive at another point. When the car is set on its way, the start time,
> travel duration and end time are all known and stored in a MySQL database,
> what I would like to happen is that an event is triggered on the server at
> the end time and then an e-mail is sent to the user. This should happen
> regardless of whether someone is browsing the website or not.
>
> I don't believe that I'll be able to solely use PHP, I have spent the
> afternoon trying to look at potential solutions but I have to admit I've
> drawn a blank. Google hasn't been helpful (64 pages so far), as any
> searches related to "event handling" bring up a load of JavaScript
> tutorials/help for 'onclick' events etc. I have searched through the PHP
> documentation and found "libevent"
> (http://www.php.net/manual/en/book.libevent.php ), I don't believe that is
> what I require (although in all honesty the lack of documentation on it
> means I'm quite in the dark as to its purpose). Another potential
> candidate I came across was a PHP/Java bridge
> (http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use the
> java virtual machine, register events with it and then callback PHP
> scripts, although this seems extremely long winded.
>
> I was hoping that someone might have some experience with this kind of
> issue and could point me in the right direction. I'm sure I've missed
> something right in front of me.
>
> Alex.

I think what you want is something to trigger a php script every
$period-of-time; if your host supports it, cron is the means of executing
an application at regular intervals down to a minute granularity. There are
some web-based cron services also, but they may not have the same
granularity as a locally based cron.


Cheers
--
David Robley

"Wow!" barked Tom, with a bow.
Today is Prickle-Prickle, the 1st day of Discord in the YOLD 3176.

From: David Hutto on
--- On *Mon, 3/15/10, David Hutto <dwightdhutto(a)yahoo.com>* wrote:

From: David Hutto <dwightdhutto(a)yahoo.com>
Subject: Re: [PHP] Event Handling
To: php-general(a)lists.php.net, "Alex Major" <php(a)allydm.co.uk>
Date: Monday, March 15, 2010, 3:34 AM



--- On Mon, 3/15/10, Alex Major
<php(a)allydm.co.uk<http://us.mc453.mail.yahoo.com/mc/compose?to=php(a)allydm.co.uk>>
wrote:

> From: Alex Major <php(a)allydm.co.uk<http://us.mc453.mail.yahoo.com/mc/compose?to=php(a)allydm.co.uk>
>
> Subject: [PHP] Event Handling
> To: php-general(a)lists.php.net<http://us.mc453.mail.yahoo.com/mc/compose?to=php-general(a)lists.php.net>
> Date: Monday, March 15, 2010, 2:59 AM
> Greetings all,
>
> I'm currently looking at building a web application,
> however I've run into
> an area of development I've not come across before. The web
> site in its
> basic form allows users to send cars from a point and then
> the car will
> arrive at another point. When the car is set on its way,
> the start time,
> travel duration and end time are all known and stored in a
> MySQL database,
> what I would like to happen is that an event is triggered
> on the server at
> the end time and then an e-mail is sent to the user. This
> should happen
> regardless of whether someone is browsing the website or
> not.
>
> I don't believe that I'll be able to solely use PHP, I have
> spent the
> afternoon trying to look at potential solutions but I have
> to admit I've
> drawn a blank. Google hasn't been helpful (64 pages so
> far), as any searches
> related to "event handling" bring up a load of JavaScript
> tutorials/help for
> 'onclick' events etc. I have searched through the PHP
> documentation and
> found "libevent" (http://www.php.net/manual/en/book.libevent.php ), I
> don't
> believe that is what I require (although in all honesty the
> lack of
> documentation on it means I'm quite in the dark as to its
> purpose). Another
> potential candidate I came across was a PHP/Java bridge
> (http://php-java-bridge.sourceforge.net/pjb/ ), whereby
> I could use the java
> virtual machine, register events with it and then callback
> PHP scripts,
> although this seems extremely long winded.
>
> I was hoping that someone might have some experience with
> this kind of issue
> and could point me in the right direction. I'm sure I've
> missed something
> right in front of me.
>
> Alex.
>
>

I'm a noob at php myself, but what you might want to look at is cron jobs
and autoresponders. Here's an address to one I've messed with before:
infinite.ibasics.biz/ I believe it uses cron jobs, I've messed with a lot so
it's hard to recall.

You might want to have the web app insert the new info in the tables, and
have the cron job and script do the rest.

David
From: Midhun Girish on
Hi ,
Just as David Hutto has said,What you need is the cronjob... Make a script
say "check.php" which checks the db to see if any new entries are made...
and if yes send the mail ...

now using the cronjob feature in linux os(which will be provided as a
service in your linux hosting cpanel), set a cronjob which calls the "
http://www.yoursite.com/check.php" URL every minute.... now a trigger will
be there every minute to the script and the emails will be send irrespective
of whether anyone is browsing the site or not.... hope it is clear...

Midhun Girish
Development Lead
MobAlive Technologies



On Mon, Mar 15, 2010 at 1:10 PM, David Hutto <smokefloat(a)gmail.com> wrote:
>
> --- On *Mon, 3/15/10, David Hutto <dwightdhutto(a)yahoo.com>* wrote:
>
> From: David Hutto <dwightdhutto(a)yahoo.com>
> Subject: Re: [PHP] Event Handling
> To: php-general(a)lists.php.net, "Alex Major" <php(a)allydm.co.uk>
> Date: Monday, March 15, 2010, 3:34 AM
>
>
>
> --- On Mon, 3/15/10, Alex Major
> <php(a)allydm.co.uk<
http://us.mc453.mail.yahoo.com/mc/compose?to=php(a)allydm.co.uk>>
> wrote:
>
> > From: Alex Major <php(a)allydm.co.uk<
http://us.mc453.mail.yahoo.com/mc/compose?to=php(a)allydm.co.uk>
> >
> > Subject: [PHP] Event Handling
> > To: php-general(a)lists.php.net<
http://us.mc453.mail.yahoo.com/mc/compose?to=php-general(a)lists.php.net>
> > Date: Monday, March 15, 2010, 2:59 AM
> > Greetings all,
> >
> > I'm currently looking at building a web application,
> > however I've run into
> > an area of development I've not come across before. The web
> > site in its
> > basic form allows users to send cars from a point and then
> > the car will
> > arrive at another point. When the car is set on its way,
> > the start time,
> > travel duration and end time are all known and stored in a
> > MySQL database,
> > what I would like to happen is that an event is triggered
> > on the server at
> > the end time and then an e-mail is sent to the user. This
> > should happen
> > regardless of whether someone is browsing the website or
> > not.
> >
> > I don't believe that I'll be able to solely use PHP, I have
> > spent the
> > afternoon trying to look at potential solutions but I have
> > to admit I've
> > drawn a blank. Google hasn't been helpful (64 pages so
> > far), as any searches
> > related to "event handling" bring up a load of JavaScript
> > tutorials/help for
> > 'onclick' events etc. I have searched through the PHP
> > documentation and
> > found "libevent" (http://www.php.net/manual/en/book.libevent.php ), I
> > don't
> > believe that is what I require (although in all honesty the
> > lack of
> > documentation on it means I'm quite in the dark as to its
> > purpose). Another
> > potential candidate I came across was a PHP/Java bridge
> > (http://php-java-bridge.sourceforge.net/pjb/ ), whereby
> > I could use the java
> > virtual machine, register events with it and then callback
> > PHP scripts,
> > although this seems extremely long winded.
> >
> > I was hoping that someone might have some experience with
> > this kind of issue
> > and could point me in the right direction. I'm sure I've
> > missed something
> > right in front of me.
> >
> > Alex.
> >
> >
>
> I'm a noob at php myself, but what you might want to look at is cron jobs
> and autoresponders. Here's an address to one I've messed with before:
> infinite.ibasics.biz/ I believe it uses cron jobs, I've messed with a lot
so
> it's hard to recall.
>
> You might want to have the web app insert the new info in the tables, and
> have the cron job and script do the rest.
>
> David
From: Ashley Sheridan on
On Mon, 2010-03-15 at 18:07 +1030, David Robley wrote:

> Alex Major wrote:
>
> > Greetings all,
> >
> > I'm currently looking at building a web application, however I've run into
> > an area of development I've not come across before. The web site in its
> > basic form allows users to send cars from a point and then the car will
> > arrive at another point. When the car is set on its way, the start time,
> > travel duration and end time are all known and stored in a MySQL database,
> > what I would like to happen is that an event is triggered on the server at
> > the end time and then an e-mail is sent to the user. This should happen
> > regardless of whether someone is browsing the website or not.
> >
> > I don't believe that I'll be able to solely use PHP, I have spent the
> > afternoon trying to look at potential solutions but I have to admit I've
> > drawn a blank. Google hasn't been helpful (64 pages so far), as any
> > searches related to "event handling" bring up a load of JavaScript
> > tutorials/help for 'onclick' events etc. I have searched through the PHP
> > documentation and found "libevent"
> > (http://www.php.net/manual/en/book.libevent.php ), I don't believe that is
> > what I require (although in all honesty the lack of documentation on it
> > means I'm quite in the dark as to its purpose). Another potential
> > candidate I came across was a PHP/Java bridge
> > (http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use the
> > java virtual machine, register events with it and then callback PHP
> > scripts, although this seems extremely long winded.
> >
> > I was hoping that someone might have some experience with this kind of
> > issue and could point me in the right direction. I'm sure I've missed
> > something right in front of me.
> >
> > Alex.
>
> I think what you want is something to trigger a php script every
> $period-of-time; if your host supports it, cron is the means of executing
> an application at regular intervals down to a minute granularity. There are
> some web-based cron services also, but they may not have the same
> granularity as a locally based cron.
>
>
> Cheers
> --
> David Robley
>
> "Wow!" barked Tom, with a bow.
> Today is Prickle-Prickle, the 1st day of Discord in the YOLD 3176.
>
>


You could store the end times in the database, and cron can run a script
that will check each of these times to find any that are within x
minutes that an email hasn't been sent out for. You'll need an extra
field to indicate whether an email has been sent or not.

Thanks,
Ash
http://www.ashleysheridan.co.uk


 |  Next  |  Last
Pages: 1 2 3 4 5
Prev: Splitting a string ...
Next: ldap_bind() connectivity