Assigning an XML object to a variable?
| From: | Brian Wilson | Date: | Thu, 01 Jul 2004 09:26:08 +0000 |
| Subject: | Assigning an XML object to a variable? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-24094@lists.php.net to get a copy of this message | ||
I'm sending a request to a remote web page using PHP's cURL in order to get
a response back in XML. I've done this before and usually assign the
response to a variable (eg. $result) before using Sablatron to transorm the
XML. Here is the code I've been using:
<?php
$varsent = 'a='.$a.'&b='.$b.'&c='.$c.'&d='.$d;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.mysite.com/xml.asp");
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $varsent);
$result=curl_exec($ch);
curl_close($ch);
?>
My next step is usually to XSLT the response held in $result. The problem
with that is that $result is holding the value '1', which I'm assuming is
simply the boolean 'true'. To see the XML response I have to
right-click/view source on the browser page. Can anyone point me in the
right direction to find out how to put this 'embedded' XML into a string or
something else that I can transform? Thanks for reading.
Brian