Please disable Adblockers and enable JavaScript for domain CEWebS.cs.univie.ac.at! We have NO ADS, but they may interfere with some of our course material.
Inventory Management
The example below will be not directly transferable to your topic. Use good judgment, but realize all functionalities.
Query List of Parts
Query e.g. via http://wwwlab.cs.univie.ac.at/~a9506264/lagerverwaltung.php
Result:
{
displays: {
"7.1": 35,
"5.0": 2,
"4.8": 17
},
akku: {
"1200mAh": 37,
...
},
...
}
Query Details
Query e.g. via http://wwwlab.cs.univie.ac.at/~a9506264/lagerverwaltung.php/displays
Result:
{
"7.1": 35,
"5.0": 2,
"4.8": 17
}
Query Details for Components
Query e.g. via http://wwwlab.cs.univie.ac.at/~a9506264/lagerverwaltung.php/displays/7.1
Result:
35
Set Details for Components
PUT to http://wwwlab.cs.univie.ac.at/~a9506264/lagerverwaltung.php/displays/7.1
Result: (non)
Client for puting:
<?php
$data = http_build_query(
array(
'wert' => '35'
)
);
$opts = array('http' =>
array(
'method' => 'PUT',
'header' =>
"Content-type: application/x-www-form-urlencoded\r\n" .
"accept: application/json\r\n"
,
'content' => $data
)
);
header('content-type: text/plain');
$context = stream_context_create($opts);
$result = file_get_contents('http://wwwlab.cs.univie.ac.at/~a9506264/lagerverwaltung.php/displays/7.1',false,$context);
print_r($result);
?>
Important: the data is in a file (in the same directory as lagerwerwaltung.php), which is e.g. called lagerverwaltung.json. In order to allow php to write this file, the access rights on almighty.cs have to be correct: login in with ssh and chmod 666 lagerverwaltung.json.
Letzte Änderung: 31.05.2017, 21:37 | 196 Worte