Hello, I am sending a request using ajax to an external API but API is not giving an exact response.
When I switch it to Apache it is working fine but not on Litespeed.
<script>
function ifscapicall(){
// var ip = document.getElementById("bank_ifsc").value;
// console.log(ip);
var ifsc = jQuery('#ifsc').val();
// alert(ifsc);
// console.log(ifsc);
jQuery.ajax({
url:'controller/ifsc_api.php',
data:'ifsc='+ifsc,
type:'post',
success:function(result){
jQuery("#result").html(result);
}
});
}
</script>
Here is php code for call api
session_start();
if(isset($_POST['ifsc'])) {
$ifsc = $_POST['ifsc'];
$json = @file_get_contents(
"https://ifsc.razorpay.com/".$ifsc);
$arr = json_decode($json);
if(isset($arr->BANK)) {
echo "<input type='text' name='bank_name' class='form-control' value='".$arr->BANK."' required>";
echo "<br>";
echo "<input type='text' name='bank_address' class='form-control' value='".$arr->ADDRESS."'>";
}
else {
echo "Invalid IFSC Code";
}
}
I am getting alway Invalid IFSC Code in litespeed but same is working fine when I switch to Apache
When I switch it to Apache it is working fine but not on Litespeed.
<script>
function ifscapicall(){
// var ip = document.getElementById("bank_ifsc").value;
// console.log(ip);
var ifsc = jQuery('#ifsc').val();
// alert(ifsc);
// console.log(ifsc);
jQuery.ajax({
url:'controller/ifsc_api.php',
data:'ifsc='+ifsc,
type:'post',
success:function(result){
jQuery("#result").html(result);
}
});
}
</script>
Here is php code for call api
session_start();
if(isset($_POST['ifsc'])) {
$ifsc = $_POST['ifsc'];
$json = @file_get_contents(
"https://ifsc.razorpay.com/".$ifsc);
$arr = json_decode($json);
if(isset($arr->BANK)) {
echo "<input type='text' name='bank_name' class='form-control' value='".$arr->BANK."' required>";
echo "<br>";
echo "<input type='text' name='bank_address' class='form-control' value='".$arr->ADDRESS."'>";
}
else {
echo "Invalid IFSC Code";
}
}
I am getting alway Invalid IFSC Code in litespeed but same is working fine when I switch to Apache