I am trying to send POST and retrieve data from that POST. Instead I get the source code of my AJAX script (ajax.php
).
<?php
$params = array('action' => 'LOL');
$query = http_build_query($params);
$contextData = array(
'method' => 'POST',
'content' => $query
);
$context = stream_context_create(array('http' => $contextData));
$result = file_get_contents(
'ajax.php',
false,
$context
);
var_dump($result);
?>
What gives?