Glen Posted November 15, 2009 Share Posted November 15, 2009 Hi everyone, I have a problem relating to using the header() function and cron jobs. What it is I play an online game and I am making a tool for it. The game I play has an ingame mailing system and you can use a url to send messages from outside the game. What this tool does is it send mails after passing a certain date. It does it by using the header() and forwarding to the url (the page which is owned by the game) that sends the message. So I use a cron job to constantly check and see if the date has been passed and if it has then send the message but the problem I am experiencing is that in the mails that I get from the cron output it just shows a hyperlink and then I see that no message has been sent. So my question is it possible to use cron jobs and header("Location: "); together? Thanks. Best regards, Glen Quote Link to comment https://forums.phpfreaks.com/topic/181622-solved-header-and-cron-jobs/ Share on other sites More sharing options...
Mchl Posted November 15, 2009 Share Posted November 15, 2009 header function is used to send HTTP headers to browser. When you run script from cron there is no browser to interpret headers (it is run in CLI mode) Quote Link to comment https://forums.phpfreaks.com/topic/181622-solved-header-and-cron-jobs/#findComment-957991 Share on other sites More sharing options...
Glen Posted November 15, 2009 Author Share Posted November 15, 2009 Hi, That would explain the problem I am having. I think I may be going off topic but is there any special way I should have the cron job set up or is there a work around I could use? Thanks. Best regards, Glen Quote Link to comment https://forums.phpfreaks.com/topic/181622-solved-header-and-cron-jobs/#findComment-958054 Share on other sites More sharing options...
Mchl Posted November 15, 2009 Share Posted November 15, 2009 curl might be what you're looking for. Quote Link to comment https://forums.phpfreaks.com/topic/181622-solved-header-and-cron-jobs/#findComment-958058 Share on other sites More sharing options...
Glen Posted November 15, 2009 Author Share Posted November 15, 2009 Hi, I read up on cURL and inserted it into my code. It worked like a dream. Thanks for your help. best regards, Glen Quote Link to comment https://forums.phpfreaks.com/topic/181622-solved-header-and-cron-jobs/#findComment-958079 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.