$_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 (z.B. nach dem Empfang von Daten aus der API) $json2= json_decode($json, true); } */ ?> $_POST["Title"], "Author"=>$_POST["Author"]); $json = json_encode($form); // 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); }*/ ?> $_POST["Title"], "author"=>$_POST["Author"], "country"=>$_POST["Country"], "link"=>$_POST["Link"], "language"=>$_POST["Language"], "pages"=>$_POST["Pages"], "year"=>$_POST["Year"], "category"=>$_POST["Category"], "imageLink"=>$_POST["ImageLink"], "lendTime"=>$_POST["LendTime"], "lendType"=>$_POST["LendType"]); $json = json_encode($form); //echo $form["title"]; $context = stream_context_create(array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => "POST", 'content' => $json ) )); // Send the request $response= file_get_contents('http://localhost:5000/api/katalog/buch', true, $context); echo $response; // Check for errors if($response === FALSE){ echo('Error!'); } // Decode the response $responseData = json_decode($response, TRUE); // Print the date from the response echo $responseData['productId']; //$data = $form; /* // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => http_build_query($form), ), ); $context = stream_context_create($options); //echo $context; // $result = file_get_contents('http://localhost:5000/api/katalog/'); //$bloed= file_put_contents('http://localhost:5000/api/katalog/', $form, FILE_APPEND); */ // http://www.php.net/manual/en/context.http.php } ?> Katalog

Katalog

Eingabe

Ausgabe

ProductId
Titel
Autor
Land
Link
Sprache
Seitenzahl
Erscheinungsjahr
Kategorie
Bildlink
Verleihdauer
Verleihtyp