Handle Post Request In Php

[Solved] Handle Post Request In Php | Php - Code Explorer | yomemimo.com
Question : php post request

Answered by : mountainpython

$url = 'http://server.com/path';
$data = array('key1' => 'value1', 'key2' => 'value2');
// use key 'http' even if you send the request to https://...
$options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data) )
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
var_dump($result);

Source : https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php | Last Update : Wed, 26 May 21

Answers related to handle post request in php

Code Explorer Popular Question For Php