Thanks again,
This is my URL manually,
http://localhost:1367/rest-api - Copy/api-alis.php?material_code=1
But, after that, I see this URL in the browser,
http://localhost:1367/rest-api%20-%20Copy/api-alis.php?material_code=1
,However, those are the same, as far as I know.
And in my code, I tested something.
For Example, when I add echo $material_code or $url, the browser returns those,
So, I don’t know what is the problem exactly?
So, I have to share API code with you.
PS: I don’t consider security issues like sql injection, …
header("Content-Type:application/json");
if (isset($_GET[‘material_code’]) && $_GET[‘material_code’]!="") {
include(‘db.php’);
$material_code = $_GET[‘material_code’];
$query = “select material_code,importation_quantity from stock_information
where material_code=$material_code”;
$result = mysqli_query($con, $query);
mysqli_query($con, “SET NAMES utf8”);
if(mysqli_num_rows($result)>0){
while($row = mysqli_fetch_array($result)) {
$material_code = $row[‘material_code’];
$importation_quantity = $row[‘importation_quantity’];
response($material_code, $importation_quantity);
//mysqli_close($con);
}
}else{
response(NULL, NULL, 200,“No Record Found”);
}
}else{
response(NULL, NULL, 400,“Invalid Request”);
}
function response($material_code, $importation_quantity){
$response[‘material_code’] = $material_code;
$response[‘importation_quantity’] = $importation_quantity;
$json_response = json_encode($response);
echo $json_response;
}
Very best regards,