Hi,
Using the Linux Cron I am trying to execute a php script , mypage.php .
The PHP page is fetching data from the mysql database . Each record is having a destination URL and an email ID. For each record I am trying to execute the script in the destination URL .
The destination URL script will trigger a mail functionality which is actualy in an another php domain.(This is the requirement flow of my client 🙂 )
For test purpose from the shell prompt of Linux , using command php mypage.php I am trying to execute the php page.
My problem is, how can I call/execute the destination URL from the Shell prompt and that will trigger the mail functionality of the second domain ? .
I can call the header("location: command. But I need to call this command for each mysql record, that is more than once. (Pls see the sample code below)
I have tried using header redirection, javascript document.location and also javascript window.open(url) methods. I am not getting the test mail from the system. But the same php script is working while running in a browser.
How can I make it to work in CRON? am I doing it in a wrong way while executing in shell? Whats about the Javascript running in CRON?
Please help me to correct this problem ASAP. Thanx in advance.
The sample code of mypage.php for your reference
<html>
<head> </head>
<body>
<?php
$sql = " SELECT url,toEmail ....";
rs = mysql_query($sql); ....
for($i=0;$i<$num_rows;$i++)
{
$scriptVar="http://".mysql_result($rs,i,0)."?email=".mysql_result($rs,i,1)."";
/* I need the call the destination URL from here . That should trigger the functionality in another domain. javaScript codes will not work from Shell . So the following also not working.
print("<script language=\"JavaScript\">document.location=\"".$scriptVar."\";</script>");
How can I call & execute it ?
*/
}
?>
</body>
<html>
Thanks & regards ,
Sathish