Go Back   SitePoint Forums > Forum Index > Program Your Site > XML and Web Services
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Jun 30, 2004, 04:56   #1
hellsgate
SitePoint Enthusiast
 
hellsgate's Avatar
 
Join Date: Jun 2004
Location: Greenock
Posts: 52
Unhappy Assigning embedded XML to a variable in PHP

First, I'd like to say hello! to everybody out there.
OK, down to business. I've been working with XML for 3-4 months, using PHPs Sablatron to transform the data. So far, this has simply been a case of using cURL to to fetch the XML which is then assigned to a variable (eg $result). This is then transformed using Sablatron, with the result placed into another variable and ECHO-ed into the browser.
At the moment I'm trying to do this to a feed which seems to behave a little differently. When I execute the cURL it returns an XML stream which needs to be read into an XML object for transforming. This is where I'm getting lost, as simply assigning a variable doesn't work. The only way I can see the XML is by right-click/viewsource. ECHOing the variable simply returns a value of '1', which I'm assuming is just the boolean 'true'. Here is the code I'm using:

<?php
$oper='COS';
$abta=J568X;
$pass='essex';
$holref='GAN20ANZM2';
$dept='LGW';
$depdate='14SEP04';
$nights='07';
$adults='2';
$children='0';
$infants='0';
$siteid='TESTXML';
$varsent='siteid='.$siteid.'&oper='.$oper.'&abta='.$abta.'&pass='.$pass.'&holr ef='.$holref.'&dept='.$dept.'&depdate='.$depdate.'&nights='.$nights.'&adults=' .$adults.'&children='.$children.'&infants='.$infants;
// echo $varsent;

$ch=curl_init();
curl_setopt($ch, CURLOPT_URL,"http://195.188.244.12/xmltier3/xml_rooms.asp");
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $varsent);
$result=curl_exec($ch);
curl_close($ch);
echo 'result - '.$result;

?>

I've googled on XML+object+php, but didn't find anything useful in the results. I've also had a search throught his forum with the same level of success. Thanks for taking the time to read this.

Brian
hellsgate is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 23:29.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved