Untitled
unknown
plain_text
2 years ago
723 B
7
Indexable
<?php // İstek yapılacak URL $url = 'http://example.com/api/endpoint'; // İstek için kullanılacak veri $data = array( 'param1' => 'value1', 'param2' => 'value2' ); // 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); // Yanıtı görüntüleme echo $response; ?>
Editor is loading...