Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
var_dump and xml result
Old 05-26-2010, 08:40 AM var_dump and xml result
Skilled Talker

Posts: 97
Trades: 0
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/onlinereservat...vice.asmx?WSDL
and i go to hotelsearch function and paste in HotelData this XML code
Code:
<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, i use var_dump($result) 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 Code:
<?
$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);
?>
john_zakaria is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-26-2010, 09:14 AM Re: var_dump and xml result
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
PHP Code:
header('content-type: text/xml');
print(
$result); 
should do it...
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-27-2010, 04:17 PM Re: var_dump and xml result
Average Talker

Posts: 20
Trades: 0
You can also do it this way, this is what I do for brevity sake...

echo "<pre>";
print_r($result);
echo "</pre>";



Also, another method I've used for a long time that I really like is placing the value into a text area.. I know that sounds odd but it makes debugging MUCH easier
__________________

Please login or register to view this content. Registration is FREE
- Awesome Price, Awesome Support, Awesomely Awesome...


Please login or register to view this content. Registration is FREE
- Web Development, E-Commerce, SEO, SMM, CMS's
holmessph is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to var_dump and xml result
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18092 seconds with 12 queries