-2
Ich möchte versuchen, Json Datenwert von URL mit PHP-Skript zu bekommen.Wie zu dekodieren JSON-Datei von URL mit PHP
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('http://username:[email protected]/openbravo/org.openbravo.service.json.jsonrest/THR_App_Rcrt_Type'),true);
foreach ($input as $key => $value){
echo "$key: $value\n";
};
Die JSON:
{
"response": {
"data": [{
"_identifier": "HR Executive",
"_entityName": "THR_App_Rcrt_Type",
"$ref": "THR_App_Rcrt_Type\/E9228AAE023F4E699BB1B2C9813A9B22",
"id": "E9228AAE023F4E699BB1B2C9813A9B22",
"organization": "F3B1FD7FA8094DEEB3ECF29C0FCA06AE",
"organization$_identifier": "Khayal Al Wataniya Company",
"client": "620768B8D9E54D919A11CCBFB129C24F",
"client$_identifier": "Khayal Al Wataniya Holding Com",
"active": true,
"creationDate": "2014-12-04T06:54:24+01:00",
"createdBy": "EF07CFDC719B4A07AB129FE2F9F45A24",
"createdBy$_identifier": "ADNAN SAEED MOHAMMED SABAGH - ",
"updated": "2014-12-04T06:54:24+01:00",
"updatedBy": "EF07CFDC719B4A07AB129FE2F9F45A24",
"updatedBy$_identifier": "ADNAN SAEED MOHAMMED SABAGH - ",
"recruitmentType": "Employment agencies",
"recruitmentInfo": "HR Executive",
"recordTime": 1464067361833
}, {
"_identifier": "HR",
"_entityName": "THR_App_Rcrt_Type",
"$ref": "THR_App_Rcrt_Type\/22203768C310447CB516258B246B92E5",
"id": "22203768C310447CB516258B246B92E5",
"organization": "F3B1FD7FA8094DEEB3ECF29C0FCA06AE",
"organization$_identifier": "Khayal Al Wataniya Company",
"client": "620768B8D9E54D919A11CCBFB129C24F",
"client$_identifier": "Khayal Al Wataniya Holding Com",
"active": true,
"creationDate": "2014-12-06T07:08:41+01:00",
"createdBy": "B2CED8798FE3490AAFFEE2301FC8DC53",
"createdBy$_identifier": "Mohammed - ",
"updated": "2014-12-06T07:08:41+01:00",
"updatedBy": "B2CED8798FE3490AAFFEE2301FC8DC53",
"updatedBy$_identifier": "Mohammed - ",
"recruitmentType": "Outsourcing",
"recruitmentInfo": "HR",
"recordTime": 1464067361836
}, {
"_identifier": "..!!",
"_entityName": "THR_App_Rcrt_Type",
"$ref": "THR_App_Rcrt_Type\/0004F2A85CB54F199D50041F5FFFEA16",
"id": "0004F2A85CB54F199D50041F5FFFEA16",
"organization": "F3B1FD7FA8094DEEB3ECF29C0FCA06AE",
"organization$_identifier": "Khayal Al Wataniya Company",
"client": "620768B8D9E54D919A11CCBFB129C24F",
"client$_identifier": "Khayal Al Wataniya Holding Com",
"active": true,
"creationDate": "2015-02-11T12:44:33+01:00",
"createdBy": "22842EF590924083B472EFE588BA98C3",
"createdBy$_identifier": "Fatemah Saleh Batterjee - ",
"updated": "2015-02-11T12:44:33+01:00",
"updatedBy": "22842EF590924083B472EFE588BA98C3",
"updatedBy$_identifier": "Fatemah Saleh Batterjee - ",
"recruitmentType": "Employment agencies",
"recruitmentInfo": "..!!",
"recordTime": 1464067361839
}],
"status": 0,
"totalRows": 3,
"startRow": 0,
"endRow": 2
}
}
Wie bekomme ich einen Wert aus es mit PHP?
'file_get_content' und' json_decode ($ file_content) 'und es für Werte foreach ......... –
Dieser Code hat bereits die innerhalb – Dale
enthaltenen Antwort das Ergebnis auf gezeigt "Antwort: Array" . aber ich brauche Datenwert. –