File: //home/cafsindia/allyindian_com/sbltt/app/city_api.php
<?php
if($_SERVER['HTTP_ORIGIN'] == "http://sblttweb.cafsinfotech.com") {
header('Access-Control-Allow-Origin: http://sblttweb.cafsinfotech.com');
}
if($_SERVER['HTTP_ORIGIN'] == "http://sblt.co.in") {
header('Access-Control-Allow-Origin: http://sblt.co.in');
}
$frm = "";
/* Module Initilization */
if (isset($_REQUEST["frm"])){
$frm = $_REQUEST['frm'];
require("./mobileapi_model.php");
$api_model = new mobileapi_model;
}
/* City Details Call API */
if ($frm === "city_info"){
$source_info = $api_model->city();
return_rslt($frm, $source_info);
}
function return_rslt($frm, $rslt){
$rslt_count = count($rslt);
if ($rslt_count === 0) {
echo json_encode(array(
'Status' => 500,
'Success' => FALSE,
'data' => "No Record found"
));
}else{
echo json_encode(array(
'Status' => 200,
'Success' => TRUE,
"data" => utf8ize($rslt)
));
}
}
function utf8ize($d) {
if (is_array($d)) {
foreach ($d as $k => $v) {
$d[$k] = utf8ize($v);
}
} else if (is_string ($d)) {
return utf8_encode($d);
}
return $d;
}
?>