Hi,
I want to use a link which has been written by API in my program, I do not know how to use it?
When I open link, It returns correct results, However in my code it returns the following error:
Warning: Invalid argument supplied for foreach()
if (isset($_POST['material-code']) && $_POST['material-code']!="") {
$material_code = $_POST['material-code'];
$url = "http://localhost:1367/rest-api - Copy/api-alis.php?material_code=".$material_code;
$client = curl_init($url);
curl_setopt($client,CURLOPT_RETURNTRANSFER,true);
$response = curl_exec($client);
$result = json_decode($response);
foreach ($result as $results) {
print "{$results->material_code} {$results->importation_quantity} \n";
}
}
How to solve it?
Thanks in advance