How to execute a URL in cron job at Linux Server
-
Dear Friends, I want to execute a redirect a URL in which i have to call a gateway server in order to send a sms. The Server on which i want to redirect a url is Linux based and the file code is on PHP. The particular php file is executed as a cron job. As a cron job runs in backgroud, we are not able to redirect (Response.redirect("url") not allowed) and also it runs at middle layer (not presentation layer); how one will be able to do the above task then? Thanks
-
Dear Friends, I want to execute a redirect a URL in which i have to call a gateway server in order to send a sms. The Server on which i want to redirect a url is Linux based and the file code is on PHP. The particular php file is executed as a cron job. As a cron job runs in backgroud, we are not able to redirect (Response.redirect("url") not allowed) and also it runs at middle layer (not presentation layer); how one will be able to do the above task then? Thanks
I spoke with a co-worker on this and he said you would need a few things. One you need a cell card to tie into the cell network. What device you use should also include a software library from sending message via SMS. With that you should need a commandline parameter list or API reference to the software. From there you can code the php to build the message and all need variables needed to pass to the software. Hope that helps.
-
I spoke with a co-worker on this and he said you would need a few things. One you need a cell card to tie into the cell network. What device you use should also include a software library from sending message via SMS. With that you should need a commandline parameter list or API reference to the software. From there you can code the php to build the message and all need variables needed to pass to the software. Hope that helps.
Dear Cjoki, I think you haven't understand the question. Well I am replying it again to make you clear that, I want to execute a url in php file which is executing in a cron job. The url after executing will be sending a sms to the specified number in the url. I hope you now understand the question and can give me a positive approach of solving it. Thanks Varun Sareen
-
Dear Cjoki, I think you haven't understand the question. Well I am replying it again to make you clear that, I want to execute a url in php file which is executing in a cron job. The url after executing will be sending a sms to the specified number in the url. I hope you now understand the question and can give me a positive approach of solving it. Thanks Varun Sareen
From my reading of SMS on wikipedia it looks like that the SMS gateways need a user login for the connection. This may be why you are getting the message you are. I wonder if you have tested your connect to the gateway outside of the php script? can you connect to the gateway using another application and send a message? Here is the SMS info for your review. http://en.wikipedia.org/wiki/SMS[^] Maybe it will shed some light on your issue.
-
From my reading of SMS on wikipedia it looks like that the SMS gateways need a user login for the connection. This may be why you are getting the message you are. I wonder if you have tested your connect to the gateway outside of the php script? can you connect to the gateway using another application and send a message? Here is the SMS info for your review. http://en.wikipedia.org/wiki/SMS[^] Maybe it will shed some light on your issue.
Dear Czoki, It's really great and so nice of you that you are showing so much of involvement into my problem but i guess you still not able to get me, I wonder where i am going wrong. Well let me try again.... My question is that how a URL can be executed in a cron job. The URL is actually calling the gateway server ( a third party client) with all the credentials required (I have checked it manually, I am able to send the sms from this gateway server by executing the php file (containing the URL) manually). But the problem is arising when I am executing the php script file from cron job, the url code is not getting executed and hence the sms is not being sent. I hope now you can understand where the problem is coming and eagerly waiting for a gud and positive reply. Thanks
-
Dear Czoki, It's really great and so nice of you that you are showing so much of involvement into my problem but i guess you still not able to get me, I wonder where i am going wrong. Well let me try again.... My question is that how a URL can be executed in a cron job. The URL is actually calling the gateway server ( a third party client) with all the credentials required (I have checked it manually, I am able to send the sms from this gateway server by executing the php file (containing the URL) manually). But the problem is arising when I am executing the php script file from cron job, the url code is not getting executed and hence the sms is not being sent. I hope now you can understand where the problem is coming and eagerly waiting for a gud and positive reply. Thanks
-
OK Varum, You are having an issue with cron running the php successfully? You can manually run the php script with success? What does your commandline look like that runs the php script?
Hello Cjoki, There you go dear, I am happy that i made you understand my problem. Well, Yes I am having an issue in php script code but not in running the php script through cron job but in executing a URL in the php code while executing the php script file through cron job (although I am able to execute the URL while executing the php file by typing the location of php file in the address bar). In order to execute a URL in php script; I have to execute it in a iframe control but the particular iframe control code is not running when i execute the php file through cron job. :( The iframe code is as follows:
(where "strURL" is the location at which my php file is present) Regards, Varun Sareen
-
Hello Cjoki, There you go dear, I am happy that i made you understand my problem. Well, Yes I am having an issue in php script code but not in running the php script through cron job but in executing a URL in the php code while executing the php script file through cron job (although I am able to execute the URL while executing the php file by typing the location of php file in the address bar). In order to execute a URL in php script; I have to execute it in a iframe control but the particular iframe control code is not running when i execute the php file through cron job. :( The iframe code is as follows:
(where "strURL" is the location at which my php file is present) Regards, Varun Sareen
iframe
s aren't PHP code, they are HTML elements that are interpreted by web browsers. You can't run a mixed HTML/PHP page using the stand-alone PHP interpreter. You must figure out what the HTML code emitted by the PHP script actually does when interpreted by a browser, then duplicate that action by a different script (possibly in another programming language). -
iframe
s aren't PHP code, they are HTML elements that are interpreted by web browsers. You can't run a mixed HTML/PHP page using the stand-alone PHP interpreter. You must figure out what the HTML code emitted by the PHP script actually does when interpreted by a browser, then duplicate that action by a different script (possibly in another programming language).markkuk is right here. Please understand that php runs on the server and your iFrame runs in the clients browser. I am not even sure how cron works into this as I thought you were making a shell program, not one that runs in a browser. Beside that you also have issues with permissions that require attention and cross site scripting issues to boot. I suspect your code logic is way off mark Varun ...sorry.
modified on Friday, October 1, 2010 10:27 AM
-
markkuk is right here. Please understand that php runs on the server and your iFrame runs in the clients browser. I am not even sure how cron works into this as I thought you were making a shell program, not one that runs in a browser. Beside that you also have issues with permissions that require attention and cross site scripting issues to boot. I suspect your code logic is way off mark Varun ...sorry.
modified on Friday, October 1, 2010 10:27 AM
Dear Cjoki, I just want to know the solution from you, friends and i very well understand that i can't run a html control code in cron job. I was just asking that the thing wasn't working what's the other way out. I wish i could have mentioned that: **"I know why
is not working in cron job otherwise i may be receiving some solution rather than such harsh comments from you friends.** . It's sad... :( Well.... Thanks Varun Sareen