I have a small PHP service that is being called in a JavaScript file by AJAX :
$.ajax({
type: "GET",
url: "getDate.php",
dataType:"json",
data :{
fromDate:fromDate,
toDate:toDate
},
success: function(data) {
......
}
});
This service contains :
$fromDate = $_GET['fromDate'];
$toDate = $_GET['toDate'];
$fromDate=date_create($fromDate);
$fromdate = date_format($fromDate,"Y-m-d")."T".date_format($fromDate,"H:i:s")."Z";
$fromdate = urlencode($fromdate);
$toDate=date_create($toDate);
$todate = date_format($toDate,"Y-m-d")."T23:00:00Z";
$todate = urlencode($todate);
$url = "http://194.209.53.19:8086/query?db=Bellevue&q=select+*+from+measures+where+time%3E%3D%27".$fromdate."%27+and+time%3C%3D%27".$todate."%27";
$data = file_get_contents($url, false);
echo $data;
I need to use this in my Rails application. I was wondering if I could put the .php file in a Rails folder, and simply call it. Or if there's a way to do a similar service in Rails?