How to extract the "SALECODE" and "PRICE" from this curl get request in php for later MySql compare and insert if it's different, and what type of JSON is the result?
?php
$url = 'http://everywhere.smartcash.ro/everywhere/rest/TSmartCashMethods/GetArticleInfo/4/1/1/1/';
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($cURL, CURLOPT_HTTPGET, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json' ));
$result = curl_exec($cURL);
curl_close($cURL);
//print_r($result);
$json = json_decode($result, true); print_r($json);
echo $json["SALECODE"];
?>
Sample Response:
{
"result":[
{
"DATASET":[
{
"SUPP_UM":"Kg",
"DETAILS":"70025",
"PRICE":"1.5",
"REC":1,
"CATEG_10":"-",
"NOTES":"",
"LASTSUPPLIER":"Furnizor 2",
"CATEG_9":"-",
"CATEG_8":"-",
"CATEG_7":"-",
"CATEG_6":"-",
"CATEG_5":"-",
"CATEG_4":"-",
"CATEG_3":"-",
"CATEG_2":"Paine",
"CATEG_1":"Panificatie",
"DIVISIBLE":0,
"SALECODE":"12",
"VAT_LETTER":"B",
"ISALT_PRICE":0,
"VAT_VALUE":"9",
"LISTED":1,
"LASTSUPPLY_UNIT_COST":"4",
"SUPP_UM_RATIO":"3.33",
"IDEXTAPP":"70025",
"IDSMARTCASH":1,
"DESCRIPTION":"12",
"LASTSUPPLY_DATE":"2015.01.05 00:00:00",
"SALE_UM":"Buc",
"IDSMARTCASH_LASTSUPPLIER":2,
"ALT_UM":"Kg",
"DISCOUNT":"0",
"LASTSUPPLY_QTY":"3",
"LASTSUPPLY_NIR":5,
"RECVERSION":284,
"NAME":"PAINE DE SECARA 300G",
"ITEM_CODES":[
{
"SALECODE":"12",
"ITEM":1,
"SALECODE_NAME":"PLU"
}
],
"SALECODE_NAME":"PLU",
"ALT_UM_RATIO":"0.3",
"IDEXTAPP_LASTSUPPLIER":"",
"CODWITHCRC":"12"
}
]
}
]
}