javascript - facing issues in executing cronjob -


sorry change in question.

i have hostgator hosting. in cpanel have created cronjob not running.

command: php /home/username/public_html/dir1/dir2/cron.php.
in email getting whole code written in file.

<html> <head> <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> <script type="text/javascript> var = 0;     function getdata(){         var dt = new date();          var user1="h";           var pass= "h";           var location1='2';           var passdata = '';           if(i==0){             month = '' + (dt.getmonth() + 1),             day = '' + (dt.getdate() + 1),             year = dt.getfullyear();                     if (month.length < 2) month = '0' + month;             if (day.length < 2) day = '0' + day;                     var date1 = year+"-"+month+"-"+day;                      passdata =  "username="+user1+"&password="+pass+"&location="+location1+"&date="+date1;                     }else{             var dd=dt.getdate();             dt.setdate(dd+i);             month = '' + (dt.getmonth() + 1),             day = '' + (dt.getdate()),             year = dt.getfullyear();                                      if (month.length < 2) month = '0' + month;             if (day.length < 2) day = '0' + day;                                  var date2 = year+"-"+month+"-"+day;             //alert(date2);             passdata =  "username="+user1+"&password="+pass+"&location="+location1+"&date="+date2;             }                $.ajax({             type: "post",             url: "www.site.com",             data : passdata,             success: function (data) {                 var new_data=json.stringify(data);                 if(i==0){                     php_send(new_data,date1,2);                 }else{                     php_send(new_data,date2,2);                  }              }         });     }     function php_send(agl,agl1,agl2)     {         if (window.xmlhttprequest)         {// code ie7+, firefox, chrome, opera, safari             var xmlhttp=new xmlhttprequest();         }         else         {// code ie6, ie5         var xmlhttp=new activexobject("microsoft.xmlhttp");         }         var url="test_php.php";                          xmlhttp.open("post",url,true);         xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded");         xmlhttp.send("p="+agl+"&date1="+agl1+"&location="+agl2);         xmlhttp.onreadystatechange=function()         {             if(xmlhttp.readystate==4 && xmlhttp.status==200)             {                 if(xmlhttp.responsetext == 1){                     i++;                     if(i<=30){                         getdata();                       }                 }             }         }       }     function createcorsrequest(method, url)      {       var xhr = new xmlhttprequest();                           if ("withcredentials" in xhr) {         // xhr chrome/firefox/opera/safari.         xhr.open(method, url, true);       } else if (typeof xdomainrequest != "undefined") {         // xdomainrequest ie.         xhr = new xdomainrequest();         xhr.open(method, url);       } else {         // cors not supported.         xhr = null;       }       return xhr;     } </script> </head> <body onload="getdata();"></body> </html> 

try /usr/bin/php-cli /home/username/public_html/dir1/dir2/cron.php or php -q /home/username/public_html/dir1/dir2/cron.php


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -