It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

var_dump and xml result

Moderator: Malcolm

var_dump and xml result

Postby john_zakaria on Wed May 26, 2010 12:42 pm

i am seleting data from webservice using php code.. but i get data in string.
i tested it in the website

http://www.soapclient.com/soaptest.html
I entered the link of myservice which is http://196.218.16.133/onlinereservation/service.asmx?WSDL
and i go to hotelsearch function and paste in HotelData this XML code
Code: Select all
<HotelsParameters><CityID>388</CityID><UserName>admin</UserName><UserPassword>admin</UserPassword><DateFrom>12/04/2010</DateFrom><DateTo>13/04/2010</DateTo><NumberOfRooms>2</NumberOfRooms><CurrencyID>162</CurrencyID><Room><RoomSerial>1</RoomSerial><Adults>1</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>5</ChildAge></Child></Room><Room><RoomSerial>2</RoomSerial><Adults>2</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>8</ChildAge></Child><Child><ChildSerial>2</ChildSerial><ChildAge>5</ChildAge></Child></Room></HotelsParameters>

and it produce XML Result

all that i need is to get it using my code, [COLOR="red"]i use var_dump($result)[/COLOR] but it did not produce XML file, it produce string

how to produce XML file using another funtion that var_dump()
MY code is
[PHP]
<?
$dom = new DOMDocument("1.0");

// display document in browser as plain text
// for readability purposes
header("Content-Type: text/plain");
// Call the Cdyne result Service. Debugging mode enabled (e.g. 'trace'=>true)
$client = new SOAPClient('http://196.218.16.133/onlinereservation/service.asmx?WSDL');

try {
$params->HotelData = '<HotelsParameters><CityID>388</CityID><UserName>admin</UserName><UserPassword>admin</UserPassword><DateFrom>12/04/2010</DateFrom><DateTo>13/04/2010</DateTo><NumberOfRooms>2</NumberOfRooms><CurrencyID>162</CurrencyID><Room><RoomSerial>1</RoomSerial><Adults>1</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>5</ChildAge></Child></Room><Room><RoomSerial>2</RoomSerial><Adults>2</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>8</ChildAge></Child><Child><ChildSerial>2</ChildSerial><ChildAge>5</ChildAge></Child></Room></HotelsParameters>'; // set up parameters to pass. If we need multiple
// parameters, we can add additional elements to
// the array: $params->City = 'Dublin'

$result = $client->HotelsSearch($params);
//echo $result;
} catch (SOAPFault $exception) {
// if we hit an error, print the exception and the XML we sent
print $exception;
print htmlspecialchars($client->__getLastRequest());
// exit;
}

var_dump($result);
?>

[/PHP]
john_zakaria
50+ Club
 
Posts: 59
Joined: Sun Feb 08, 2009 7:29 am

Re: var_dump and xml result

Postby HotNoob on Tue Jun 01, 2010 8:08 pm

var_dump is sort of a debugging thing.
If you want it to not print out all of that extra junk, try using

echo $result;

if $result is an array you will need to loop through the variable.
HotNoob
100+ Club
 
Posts: 169
Joined: Sun May 02, 2010 1:38 am


Who is online

Users browsing this forum: No registered users and 0 guests