php - Execute a script at certain times on external web server without cron -
i've got website hosted on external web hosting service amongst other things, allows users subscribe events , added registration list.
i'd able remind these users via email 1 day before event occurs, remind them updated information location, etc..
currently, hosting service doesn't support cron jobs, thought provide means achieve this.
i've had idea of executing function when user visits front page nearest time when send emails, seems bad option , left me thinking there must better way.
i know of companies execute scripts @ specific time fee, more flexibility being able configure directly on website.
i'm wondering if there api in php allow me this, or if idea best way of achieving goal, or missing obvious..
any appreciated.
take @ mcrypt_encrypt
, mcrypt_decrypt
functions. can set php
script on external page get
parameter input. input used authentication noone unauthorized runs script. use above functions encrypt , decrypt authorization key. like, suggest create random, example:
$authmessage = 'yourmessage' . date('y-m-d', time());
and encode it, send through get
. encrypted message change every day, noticeably harder break in.
on remote server, read encrypted message get
. decode using same key used encode , check if everything's fine (that means, if string decoded , date today's date). if ok, can start script.
you can using simplier method, involving md5()
:
on primary server call page get
parameter this:
$get = md5('your secret phrase, longer better'.date('y-m-d', time()));
on remote server, when request get
parameter comes, same, , check if md5 generated equal 1 came get
. if is, run script.
of course have call remote server remotely somehow... assume, you're able run cron
on primary server, won't issue.
Comments
Post a Comment