102 lines
No EOL
3.3 KiB
PHP
102 lines
No EOL
3.3 KiB
PHP
<?php
|
|
if(isset($_POST["go"]))
|
|
{
|
|
|
|
$url = 'localhost:5000/api/katalog';
|
|
|
|
|
|
// use key 'http' even if you send the request to https://...
|
|
$options = array(
|
|
'http' => array(
|
|
'header' => "Content-type: application/json\r\n",
|
|
'method' => 'POST'
|
|
),
|
|
);
|
|
$context = stream_context_create($options);
|
|
//echo $context;
|
|
$id= $_POST["ProductId"];
|
|
$result = file_get_contents('http://localhost:5000/api/katalog/'.$id);
|
|
//echo $result;
|
|
$json= json_decode($result, true);
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Katalog</title>
|
|
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
|
|
</head>
|
|
<body>
|
|
<div class="Titel">
|
|
<a href="index.html"><button id= "zurueck">zurück</button></a>
|
|
<h1>Katalog</h1>
|
|
</div>
|
|
<div class="Eingabe">
|
|
<h2>Eingabe</h2>
|
|
<form method="post">
|
|
<input type="number" name="ProductId" class="input" placeholder="Geben Sie die gesuchte ProduktId an" min= "1" required>
|
|
<input type="submit" name="go" id="go">
|
|
</form>
|
|
</div>
|
|
|
|
<div class="Ausgabe">
|
|
<h2>Ausgabe</h2>
|
|
<table>
|
|
<tr>
|
|
<td class ="fix">ProductId</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['productId']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Titel</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['title']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Autor</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['author']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Erscheinungsland</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['country']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Link</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['link']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Sprache</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['language']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Seitenzahl</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['pages']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Erscheinungsjahr</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['year']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Kategorie</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['category']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Bildlink</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['imageLink']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Verleihdauer</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['lendTime']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fix">Verleihart</td>
|
|
<td><?php if(isset($_POST["go"])) echo $json['lendType']; ?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|