Commit 5fa89caa authored by Johannes Metscher's avatar Johannes Metscher
Browse files

utf-8 als charset

parent 81e3249b
<?php
header("Content-Type: text/html; charset=utf-8");
/**
* @file Einfacher CURL-PHP client zum testen der LiMS Schnittstelle
*
......@@ -8,26 +9,27 @@
* Time: 09:14
*/
$host = isset($_POST['host'])? $_POST['host'] : 'https://bildungsnetz.dosb.de/api/lims/request';
$username = isset($_POST['username'])? $_POST['username'] : "";
$password = isset($_POST['password'])? $_POST['password'] : "";
$host = isset($_POST['host']) ? $_POST['host'] : 'https://bildungsnetz.ghostthinker.de/api/lims/request';
$username = isset($_POST['username']) ? $_POST['username'] : "";
$password = isset($_POST['password']) ? $_POST['password'] : "";
$training_course_id = 932;
//zusammenbauen der Parameter
if(isset($_POST['data'])) {
if (isset($_POST['data'])) {
$new_license_data = array();
$d = explode("\n", $_POST['data']);
foreach($d as $e){
foreach ($d as $e) {
$ps = explode('=>', $e);
if(!empty($ps[0])) {
if (!empty($ps[0])) {
$new_license_data[trim($ps[0])] = trim($ps[1]);
}
}
$data = $_POST['data'];
}else {
}
else {
$new_license_data = array(
'postal' => 42431,
......@@ -55,7 +57,7 @@ if(isset($_POST['data'])) {
$data .= "$k => $v \n";
}
}
if(!empty($_POST)) {
if (!empty($_POST)) {
$additionalHeaders = '';
......@@ -79,15 +81,27 @@ if(!empty($_POST)) {
//request ausführen
$response = curl_exec($process);
//falls download, ausgabe der PDF
if (strpos($host, 'download')) {
header("Content-type: application/pdf");
header("Content-Disposition: attachment; lizenz.pdf");
header("Pragma: no-cache");
header("Expires: 0");
print $response;
die();
}
$errors = NULL;
if (curl_errno($process)) {
$errors= 'Curl error: ' . curl_error($process);
$errors = 'Curl error: ' . curl_error($process);
}
$header_size = curl_getinfo($process, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$body = substr($response, $header_size);//json_decode(substr($response, $header_size));
}else{
}
else {
$body = $header = $errors = "no reponse sent yet";
}
?>
......@@ -96,19 +110,20 @@ if(!empty($_POST)) {
input[type="text"], textarea {
width: 500px;
}
label {
display: block;
}
</style>
<form method="post">
<form method="post" accept-charset="UTF-8">
<h1>Request form</h1>
<label for="host">Host and service</label>
<input type='text' name="host" value="<?php print $host ?>"/>
<label for="username">Username</label>
<input type='text' name="username" value="<?php print $username ?>"/>
<label for="password">Password</label>
<input type='text' name="password" value="<?php print $password ?>"/>
<input type='password' name="password" value="<?php print $password ?>"/>
<label for="data">Data</label>
<textarea type='text' name="data" rows="20"><?php print $data ?></textarea>
<br/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment