I have a commercially-available PHP script that processes XML data for various maintenance issues on my site. Although most users of the script would use it to take data from websites other than where the script itself is hosted, I actually only need it to handle data from the same domain where the script is located.
I’ve been submitting data to the script via HTTP:
<?php
$url = https://example.com/api.php;
$xmlrequest = '<xmldata></xmldata>';
$opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: text/xml', 'content' => $xmlrequest));
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
?>
That works okay, but I’d rather work with the local file system instead of HTTP if possible. Any ideas on how to alter this code snippet to do that?