tested pasta
This commit is contained in:
parent
4bf926b8e3
commit
bc5ab4adc9
2 changed files with 20 additions and 13 deletions
|
@ -14,21 +14,25 @@
|
|||
?>
|
||||
|
||||
<?php
|
||||
fsockopen('www.google.com', 80);
|
||||
|
||||
//Zugriff auf API
|
||||
if(isset($_POST["go"]))
|
||||
{
|
||||
$Title= $_POST['Title'];
|
||||
$url= "tcp://localhost:5000/api/katalog"; // stimmt die URL?
|
||||
$url= "https://localhost:5001/api/katalog"; // stimmt die URL?
|
||||
$client = curl_init($url);
|
||||
|
||||
//echo $response;
|
||||
$fp = @fsockopen($client, 5000, $errno, $errstr);
|
||||
$response=curl_exec($client);
|
||||
$result= file_get_contents($url);
|
||||
//$fp = @fsockopen($client, 80, $errno, $errstr);
|
||||
$response=curl_exec($url);
|
||||
echo $errstr;
|
||||
//echo $fp;
|
||||
echo $response;
|
||||
|
||||
|
||||
|
||||
$result = json_decode($response);
|
||||
echo $result;
|
||||
$form = array(
|
||||
"Title"=>$_POST["Title"],
|
||||
"Author"=>$_POST["Author"]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
if(isset($_POST['link'])) {
|
||||
$link = $_POST['link'];
|
||||
if(isset($_GET['link'])) {
|
||||
$link = $_GET['link'];
|
||||
|
||||
//remove protocol, we're assuming its http
|
||||
if(strstr($link, '://') != false){
|
||||
|
@ -15,6 +15,7 @@ if(isset($_POST['link'])) {
|
|||
$fp = @fsockopen($host, 80, $errno, $errstr);
|
||||
|
||||
if($fp == false){
|
||||
$response= "Hallo";
|
||||
$response = $errno . " " . $errstr;
|
||||
}
|
||||
else {
|
||||
|
@ -22,24 +23,26 @@ if(isset($_POST['link'])) {
|
|||
$headers = array();
|
||||
$headers[] = 'HEAD ' . $request . ' HTTP/1.1';
|
||||
$headers[] = 'Host: ' . $host;
|
||||
$headers[] = 'Content-Length: 0';
|
||||
//$headers[] = 'Content-Length: 0';
|
||||
$headers[] = 'Connection: close';
|
||||
$headers[] = 'Content-Type: text/html';
|
||||
$headers[] = 'Content-Type: application/json; charset=utf-8';
|
||||
$headers = implode("\r\n", $headers) . "\r\n\r\n";
|
||||
|
||||
//send our request
|
||||
if (!fwrite($fp, $headers)) {
|
||||
fclose($fp);
|
||||
$response = "Could not access webpage specified.";
|
||||
$response = "Hallo.";
|
||||
}
|
||||
else {
|
||||
//read the response
|
||||
$rsp = '';
|
||||
while(!feof($fp)) { $rsp .= fgets($fp,8192); }
|
||||
fclose($fp);
|
||||
//fclose($fp);
|
||||
/*
|
||||
$hunks = explode("\r\n\r\n",trim($rsp));
|
||||
$headers = explode("\n", $hunks[count($hunks) - 1]);
|
||||
$response = trim($headers[0]);
|
||||
$response = trim($headers[0]);*/
|
||||
$response= $rsp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +53,7 @@ if(isset($_POST['link'])) {
|
|||
</head>
|
||||
<body>
|
||||
<?php if(isset($response)) { echo $response; } ?>
|
||||
<form method="post">
|
||||
<form method="get">
|
||||
<label for="link">Link</label>
|
||||
<input id="link" type="text" name="link" />
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue