General Community > Off-Topic
PHP Cronjob --> Automatically submit newsitem via e-mail
Woudloper:
Hi,
Currently I had just some thought and was wondering if something like this is possible to combine with ‘WebsiteBaker’!?
Some while ago someone told me what cronjob are and what you might do with these. The explanation was clear and now I was thing of the following and if something like this can be made possible.
For one of the website I am using I want to give the opportunity for someone to submit weblog postings (with the news module). The person does not has internet access at work, but wants to post an weblog item from work. Would it be possible to do the following with a cronjob:
* Import the e-mails sent to a specific mailbox;
* Read the content of the e-mail (possible with html layout)
* Put the information into the news table
If this is possible that would help one of my clients a lot.
Since I am not that experienced with cronjobs hints are welcome.
xillion:
--- Quote from: Woudloper on May 12, 2006, 01:39:38 PM ---Hi,
Currently I had just some thought and was wondering if something like this is possible to combine with ‘WebsiteBaker’!?
Some while ago someone told me what cronjob are and what you might do with these. The explanation was clear and now I was thing of the following and if something like this can be made possible.
For one of the website I am using I want to give the opportunity for someone to submit weblog postings (with the news module). The person does not has internet access at work, but wants to post an weblog item from work. Would it be possible to do the following with a cronjob:
* Import the e-mails sent to a specific mailbox;
* Read the content of the e-mail (possible with html layout)
* Put the information into the news table
If this is possible that would help one of my clients a lot.
Since I am not that experienced with cronjobs hints are welcome.
--- End quote ---
I cannot give you the right hint.. but your plans is in theory right..
But you have to have a command line i think or make a batch script for it..
I think there is a better solution... get an internet connection for your client.. the internet seems to be interesting :wink:
rsmith:
Hi,
I've done all the peices of this before, just not as a single program, no reason it couldn't be done.
at first thought:
A few issues exist to do what you want
* on your server you would need the ability to schedule cron jobs
* you would need POP3 or IMAP access to the email server to check your mail
* you would need the IMAP functions installed as part of the php config
Cron jobs (linux) or via the Task scheduler (windows) a job can be scheduled to run,
with windows, a simple batch file, " php.exe filename.php?var1=xxx&var2=yyy "
not exactly sure with linux but should be close to the same
would need to "configure" via WB the server, username, password for the email server/account, configure the WB news module to be used to store the post
using the imap php function read the mail
get the body of the message
post to the database, and check
then delete the mail from the mailbox.
The module could be built into WB
a "modify.php" to manage the settings, and even manualy call the "cronjob.php"
a "cronjob.php" to be executed by the cronjob/taskmanager
checks could also be done so a "special" account is not needed, ie test on the subject line?... or the first line of the body, looking for a key phrase (WB News Post) a check of the from address so only "allowed" email addresses can post
at first thought this seems to be a very do'able project.. the biggest and hardest to solve issue would be your mail server, if it doesnt allow pop3/imap access then your stuck..
I'll think about this more, who wants to write it? or do I get that pleasure too? :-D
Rob
pcwacht:
Instead of a cronjob, in case you don't have shell access, you could include a litle programm into your templates index.php page (or maybe better to inlclude it on the startpage wich does:
check time, if enough time has expired call the programm wich extract the mail etc
I believed this is called pseude cron
This way you keep the control within wb
John
rsmith:
@ pcwacht
Good idea...
even go a step further.... have an insertable page instead of part of the template (view.php) that you can insert as a section above the news section , this could call the "cronjob.php" and update the database based on time from the last update...
it wouldn't need to display anything (but could)
Rob
Navigation
[0] Message Index
[#] Next page
Go to full version