Untitled
unknown
php
2 years ago
1.5 kB
6
Indexable
if (isset($_GET['submit'])) { echo "submite basildi"; if ($_SERVER["REQUEST_METHOD"] === "GET") { echo "server istek"; // İstek yapılacak URL $url = 'http://localhost:8080/api/appUsers/'; // İstek için kullanılacak veri $data = array( 'tcIdNumber' => $_GET["ID"], 'password' => $_GET["password"] ); // JSON formatına dönüştürme $jsonPayload = json_encode($data); // İstek ayarları $options = array( 'http' => array( 'method' => 'GET', 'header' => "Content-Type: application/json\r\n" . "Content-Length: " . strlen($jsonPayload) . "\r\n", 'content' => $jsonPayload ) ); // Kontekst oluşturma $context = stream_context_create($options); // İstek gönderme $response = file_get_contents($url, false, $context); echo "response = " . $response; if ($response === false) { echo "Error fetching contents of URL"; } else { $decoded_response = json_decode($response); //$last_index = $decoded_response[count($decoded_response) - 1]; //echo(var_dump($decoded_response->isAdmin)); print_r($decoded_response); //echo ("echo decoded responses isAdmin = " . strval($decoded_response->isAdmin) ."<br>"); //echo("last index = " . $last_index . "<br>"); //print_r("printr last index = " . $last_index); }
Editor is loading...