a few changes and tests
This commit is contained in:
parent
26069bb314
commit
f3551ee100
2 changed files with 53 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php /*
|
||||
if(isset($_POST["go"]))
|
||||
{
|
||||
$form = array(
|
||||
|
@ -6,11 +6,56 @@
|
|||
"Author"=>$_POST["Author"]);
|
||||
$json = json_encode($form);
|
||||
//echo $json;
|
||||
|
||||
// Dieser Schritt dient nur um die Daten wieder in der Ausgabe anzeigen zu lassen,
|
||||
//muss später noch an eine andere Stelle gepackt werden 8z.B. nach dem Empfang von Daten aus der API)
|
||||
$json2= json_decode($json, true);
|
||||
} */
|
||||
?>
|
||||
|
||||
<?php
|
||||
//Zugriff auf API
|
||||
if(isset($_POST["go"]))
|
||||
{
|
||||
$Title= $_POST['Title'];
|
||||
$url= "tcp://localhost/api/katalog"; // stimmt die URL?
|
||||
$client = curl_init($url);
|
||||
$fp = @fsockopen($client, 443, $errno, $errstr);
|
||||
echo $errstr;
|
||||
//echo $fp;
|
||||
|
||||
$response=curl_exec($client);
|
||||
$result = json_decode($response);
|
||||
$form = array(
|
||||
"Title"=>$_POST["Title"],
|
||||
"Author"=>$_POST["Author"]);
|
||||
$json = json_encode($form);
|
||||
//echo $json;
|
||||
|
||||
|
||||
// Dieser Schritt dient nur um die Daten wieder in der Ausgabe anzeigen zu lassen,
|
||||
//muss später noch an eine andere Stelle gepackt werden 8z.B. nach dem Empfang von Daten aus der API)
|
||||
$json2= json_decode($json, true);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php /*
|
||||
//nur zum Test einer GET-Methode
|
||||
if(isset($_GET["test"]))
|
||||
{
|
||||
$url= "http://localhost:5000/api/katalog/1";
|
||||
$contents = file_get_contents($url);
|
||||
if($contents !== false){
|
||||
//Print out the contents.
|
||||
echo $contents;
|
||||
}
|
||||
|
||||
//$client = curl_init($url);
|
||||
//$response=curl_exec($client);
|
||||
$Title= $_GET['Title'];
|
||||
$result = json_decode($response);
|
||||
echo $result['title'];
|
||||
}*/
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -29,7 +74,7 @@
|
|||
|
||||
<div class="Eingabe">
|
||||
<h2>Eingabe</h2>
|
||||
<form action="" method="post">
|
||||
<form method="post">
|
||||
<input type="text" name="Title" class="input" placeholder="Titel">
|
||||
<input type="text" name="Author" class="input" placeholder="Autor">
|
||||
<input type="text" name="Country" class="input" placeholder="Herkunft">
|
||||
|
@ -61,11 +106,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="fix">Titel</td>
|
||||
<td><?php echo $json2['Title']; ?></td>
|
||||
<td><?php if(isset($_POST["go"])) echo $json2['Title']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fix">Autor</td>
|
||||
<td><?php echo $json2['Author']; ?></td>
|
||||
<td><?php if(isset($_POST["go"])) echo $json2['Author']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fix">Land</td>
|
||||
|
|
|
@ -31,7 +31,8 @@ body
|
|||
resize: none;
|
||||
overflow: auto;
|
||||
width: 90%;
|
||||
height: 3%;
|
||||
height: 5%;
|
||||
margin-top: 10px;
|
||||
margin-left: 5%;
|
||||
}
|
||||
#go
|
||||
|
|
Loading…
Reference in a new issue