Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Sending XML data to local script for processing

Works fine over HTTP, would rather use local file system

5:53 pm on Nov 30, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 9, 2003
posts: 1908
votes: 0

I'm running a commercial API that is primarily meant to accept and process data from remote domains, but for my purposes, I only need to feed it data from the same domain the API resides on. Thus, while I can get the functionality I need by submitting data via HTTP, that just seems like a waste and I'd rather use the local file system.

Here's the code I have now, which submits the data via HTTP:

$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);

What are some good ways to use the local file system instead? (I should mention that my host doesn't support the exec() function.)

Any ideas?
7:04 pm on Dec 1, 2010 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

You may need to review the API instead. Seems it should be able to handle XML from an external source or fed directly, you just need to find the method that does that function.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members