homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Sending XML data to local script for processing
Works fine over HTTP, would rather use local file system

WebmasterWorld Senior Member 10+ Year Member

Msg#: 4236959 posted 5:53 pm on Nov 30, 2010 (gmt 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?



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

Msg#: 4236959 posted 7:04 pm on Dec 1, 2010 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved