radox Posted May 1, 2006 Share Posted May 1, 2006 I could use a little insight on XML posting.I have a company that would like to "post" XML data to one of my servers.I really don't understand this "posting" process.Does anyone have an example file, or snippet of code, they can send to help me understand?Much appreciated. Quote Link to comment Share on other sites More sharing options...
ober Posted May 1, 2006 Share Posted May 1, 2006 Maybe you should ask them what they mean first. If they just want to store XML files on your server, that's nothing more than a normal upload script. Quote Link to comment Share on other sites More sharing options...
radox Posted May 1, 2006 Author Share Posted May 1, 2006 While I appreciate your reply, I'm looking for a response from someone that has implemented XML posting through web services like XML_RPC. I need an example file or code to get started....This is becoming common practice for automation between servers.The company has given me and XML example file and the associated XSD file.It's up to me to create the file on my end to intercept their transmission. Quote Link to comment Share on other sites More sharing options...
ober Posted May 1, 2006 Share Posted May 1, 2006 Alright... you don't need to get snippy. You could have explained yourself a little better. Quote Link to comment Share on other sites More sharing options...
radox Posted May 1, 2006 Author Share Posted May 1, 2006 I didn't mean to be snippy...sorry...Did my last post help? Do you have any sort of resolution or example? Quote Link to comment Share on other sites More sharing options...
ober Posted May 1, 2006 Share Posted May 1, 2006 That will probably help someone, but I don't personally have any experience in that area. But I'll bump the thread again for you just in case someone else does. Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted May 2, 2006 Share Posted May 2, 2006 Your talking about something like an EDI transmission yes? They FTP the file, your script reads and then acts upon that data like "posting" it to other databases and applications? Quote Link to comment Share on other sites More sharing options...
radox Posted May 2, 2006 Author Share Posted May 2, 2006 Yes, something like that...but the raw data passes over secure http, not ftp.I just can't seem to find an example file or code.I guess there is a PHP function called "get_xml_raw" or something along those lines??I'm looking for any direction really.Thanks for your post. Quote Link to comment Share on other sites More sharing options...
Barand Posted May 2, 2006 Share Posted May 2, 2006 Does this example help any? (PHP5 required):::newsfeed.xml:::[code]<?xml version="1.0" encoding="utf-8"?><!-- generator="whocares" --><rss version="0.92"><channel> <title>Website Name</title> <link>http://www.websiteurl.com</link> <description>Description of website</description> <lastbuilddate>Sun, 19 Sep 2004 04:34:52 +0000</lastbuilddate> <docs>http://backend.userland.com/rss092</docs> <item> <title>1st Title</title> <description>1st Description</description> <link>http://www.websiteurl.com/1stlink/</link> <pos>L</pos> </item> <item> <title>2nd Title</title> <description>2nd Description</description> <link>http://www.websiteurl.com/2ndlink/</link> <pos>R</pos> </item></channel></rss>[/code]:::newsfeed.xsl:::[code]<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <xsl:apply-templates/></xsl:template> <xsl:template match="rss/channel"> <DIV class='main'> <h3><xsl:value-of select="title"/></h3> <p><xsl:value-of select="description"/></p> <xsl:apply-templates select="item"/> </DIV></xsl:template><xsl:template match="item"> <DIV class='item'> <table border='1' width='100%'> <xsl:choose> <xsl:when test="pos='L'"> <tr> <td><xsl:apply-templates select="title"/></td> <td><xsl:apply-templates select="description"/></td> </tr> </xsl:when> <xsl:otherwise> <tr> <td><xsl:apply-templates select="description" /></td> <td><xsl:apply-templates select="title" /></td> </tr> </xsl:otherwise> </xsl:choose> </table> </DIV></xsl:template><xsl:template match="title"> <span style="color: #0000FF"><xsl:value-of select="." /></span></xsl:template><xsl:template match="description"> <span style="color: #FF0000"><xsl:value-of select="." /></span> </xsl:template></xsl:stylesheet>[/code]:::newsfeed.php:::[code]<html><head><meta name="generator" content="PhpED Version 4.5 (Build 4513)"><title>XSLT sample</title><link rel="shortcut icon" href="favicon.ico"><STYLE>DIV.main {border: 1pt solid gray; background-color: silver; width: 400px; padding: 10px}DIV.item {border: 1pt solid gray; background-color: #FFFFC0; width: 380px; margin-bottom='5'}</STYLE></head><body> <?php $xml = simplexml_load_file('newsfeed.xml'); $xsl = simpleXML_load_file('newsfeed.xsl'); $proc = new XsltProcessor(); $proc->importStylesheet($xsl); $newxml = $proc->transformToDoc($xml); print $newxml->saveXML(); ?> </body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.