?
Solved

Receive cXML Example

Posted on 2008-10-22
5
Medium Priority
?
1,151 Views
Last Modified: 2013-11-18
I'm looking for example Php code for receiving cXML, parsing, and returning responce cXML.

I believe the xml will be received as a form post via HTTP, so I assume I need to loop through  $_POST.
0
Comment
Question by:ncw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 22776873
Here is the link to the man pages for cXML
http://xml.cxml.org/current/cXMLUsersGuide.pdf

The XML file will probably be received as a string - it may come via $_POST, but it does not need to be processed as an array.  You can use SimpleXML to process it.
http://us2.php.net/manual/en/simplexml.examples.php

See the code snippet for an example of using SimpleXML to extract information from an XML doc.  In this example, it happens to be information from the Yahoo geocoder, but the principles are the same for any XML.

Best regards, ~Ray
// $y_buf CONTAINS THE DATA RECEIVED FROM Yahoo!
$ydata	= new SimpleXMLElement($y_buf);
$y_lat	= $ydata->Result->Latitude;
$y_lon	= $ydata->Result->Longitude;
$y_zip	= $ydata->Result->Zip;

Open in new window

0
 
LVL 1

Author Closing Comment

by:ncw
ID: 31528165
Thanks for your comments Ray. Yes I had seen the cXML UsersGuide.pdf before, that was my starting point but I didn't find it very useful for providing example code. Unfortunately this project has stalled but I'm hoping it will restart in the New Year.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 23226106
Thanks for the points, and best wishes for the new year! ~Ray
0
 
LVL 1

Author Comment

by:ncw
ID: 23838607
I found the xml in $GLOBALS['HTTP_RAW_POST_DATA']
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question