< >

requesr-vom-anderen-serve-erlauben-getempfanger.php


Quell Code


<?php
if (isset($_SERVER["HTTP_ORIGIN"]) === true) {
    $origin = $_SERVER["HTTP_ORIGIN"];
    $allowed_origins = array(
        "https://codepen.io",
        "https://s.codepen.io"
	);
	if (in_array($origin, $allowed_origins, true) === true) {
		header('Access-Control-Allow-Origin: ' . $origin);
		header('Access-Control-Allow-Credentials: true');
		header('Access-Control-Allow-Methods: POST');
    	header('Access-Control-Allow-Methods: GET');        
		header('Access-Control-Allow-Headers: Content-Type');
	}
    
    
    $zeit=date('d.m.Y H:i:s' ,time('U'));
    
    
    
    if(isset($_GET['deintext'])){
    $escape=htmlspecialchars($_GET['deintext']);
        $daten=$zeit.' = incomming GET = Dein Text : '.$escape;
    }else if(isset($_POST['deintext'])){
    $escape=htmlspecialchars($_POST['deintext']);
        $daten=$zeit.' = incomming POST = Dein Text : '.$escape;
    }else{
        $daten='';
    }
 
 //erster backzum server
 
    // var_dump($_SERVER["REQUEST_METHOD"]);
 //	if ($_SERVER["REQUEST_METHOD"] === "OPTIONS") {
      //$data = json_decode($_POST['test']);
      $file='test1.txt';
 
            file_put_contents($file, $daten."\n", FILE_APPEND | LOCK_EX);
      $sammeln.= 'Deine Anfrage wurde empfangen und gespeichert<br>';
        $sammeln.= '<h4> Alle gesendeten Texte von Codepen</h4><br><br>';
echo $sammeln;

$data = file_get_contents($file); //read the file
$convert = explode("\n", $data); //create array separate by new line

for ($i=0;$i<count($convert);$i++)  
{
    echo htmlspecialchars($convert[$i]).'<br> '; //write value by index
}


       
 //	exit;
}else{

}
?>

Add Comment

* Required information
1000
Powered by Commentics

Comments (1)

Gravatar
Admin
Sascha65says...

Die Canvas Balken Uhr ist ja mal Fett