<?php
$url = "http://localhost/WS0910/restserver.php";
$ch = curl_init();
echo ' <form method="post">
Name: <input type="text" name="name" /><br/>
Sequenz:<br/><textarea name="xml" cols="22"
rows="10"></textarea>
<input type="submit" value="Post" />
</form>
<hr/>
<form method="get">
Name: <input type="text" name="seqs" />
<input type="submit" value="Get" />
</form>
<hr/>
<form method="get">
Name: <input type="text" name="seqd" />
<input type="submit" value="Delete" />
</form>
<hr/>';
if(isset($_POST['name']) && $_POST['name'] != '')
{
curl_setopt($ch, CURLOPT_URL, $url.'/'.$_POST['name']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST['xml']);
curl_setopt($ch, CURLOPT_POST, true);
curl_exec($ch);
echo 'POST: ' . $_POST['name'] . ' --> ' . $_POST['xml'];
}
if(isset($_GET['seqs']) && $_GET['seqs'] != '')
{
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url.'/'.$_GET['seqs']);
curl_setopt($ch, CURLOPT_HTTPGET, true);
echo "GET: " . $_GET['seqs'] . ' --> ' . curl_exec($ch);
}
if(isset($_GET['seqd']) && $_GET['seqd'] != '')
{
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url.'/'.$_GET['seqd']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_exec($ch);
echo 'DELETE: ' . $_GET['seqd'];
}
curl_close($ch);
?>
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de