Automating a process on a server, PHP, etc.

pirateboy91, Oct 7, 7:21am

Don't know if anyone will know the answer to this, but thought I would try.
Take for example Trademe, how the server automatically sends a user an email at the end of the auction.

Obviously it isn't a process that occurs in the page that the user is on, but it runs on the server, in the background...

How would we implement that?
Anyknow know?

swivel, Oct 7, 7:24am
Well for an Auction site program, thats Built into it (well it is on my Auction site).Most WeBid sites do anyway.

little_egypt, Oct 7, 7:26am
Usually is DOES occur 'on the page' .. the same script that generates the page sent to the viewer also generates a corresponding email and drops it into the local mail spool to be sent.

ferita, Oct 7, 7:27am

pirateboy91, Oct 7, 7:30am
that would mean the user has to be present when the auction finishes, which they don't.

pirateboy91, Oct 7, 7:30am
thanks. I'm talking about how to do this oneself, not relying on any other program.

d.laidlaw, Oct 7, 7:31am
You can have a cron job run a php script assuming your host permits such things.

pirateboy91, Oct 7, 7:36am
That's sort of along the lines of what I was asking... Thanks very much.
Will look into that.

segadc, Oct 7, 7:37am
there are multiple ways to go about this. it all depends on wat you are trying to achieve and your skill set.

for example trademe could generate an email on creation of an auction and have it scheduled to be sent by the email server at the time the auction ends.

or a cron script could be setup to monitor for expiring listings then send an email.

pirateboy91, Oct 7, 7:42am
I have used PHP and MySQL to create a system which allows a user to register, login, create new auctions, etc
but I'm at a point now where I need the system to recognisewhen an auction has expired and take appropro action
(which would include 1 - sending an email to the winner of the auction, etc or 2 - sending an email to the lister to notify it had not sold)

the easiest way would be to put it in a page and process it that way, but that means the SYSTEM itself is not processing it

segadc, Oct 7, 7:49am
both those methods I mentioned will work for what you want, depending on how popular your auction site is constantly monitoring you msql database could end up being very resource intensive. there are probably other methods too. but I use both of the above for some of my projects.

lifesteala, Oct 7, 9:54am
Script automation on the server is done by the use of Cron Jobs.. (on a linux server).

Create a script that will go through all auctions that are flagged Not Expired. For each, if the expiration date/time is less than NOW - set flag to Expired.

Then - as you loop - set up your mail process.

Hope that helps.

jayc2007, Oct 7, 11:15am
Why don't you set it to send the email when the auction closes (ie when time left = 0 then display auction closed & send email to $seller & $buyer)...

How are you ending your auctions at the mo?

little_egypt, Oct 7, 7:10pm
It might be easier to just build on something that already exists;

pirateboy91, Oct 11, 2:09am
At the moment it's basically
when closedate < now()

I've managed to get cron jobs triggering a php script which
checks auctions that were not bid on as well as auctions that closed with bids; which either notifies the lister of the auction or notifies both parties.

pirateboy91, Oct 11, 2:11am
defeats the purpose of learning how to do something yourself, tho.

Share this thread

Buy me a coffee :)Buy me a coffee :)