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
Old 05-02-2010, 04:31 AM really i need help
Skilled Talker

Posts: 97
Trades: 0
i have a long time trying to fix my problem and i did not. so please help me..

i have a web service at this url http://196.218.16.133/onlinereservat...p=HotelsSearch

i use hotel search file with HotelSearch method and method will retrieve xml file contains the matched data.

the varialbe that i made post with it is named : HotelData

the data of the variable is a string file that contains an xml data like this
HTML Code:
<HotelsParameters>	
<CityID>388</CityID>
<UserName>admin</UserName>	
<UserPassword>admin</UserPassword>	
<DateFrom>4/12/2010</DateFrom>	
<DateTo>4/13/2010</DateTo>	
<NumberOfRooms>2</NumberOfRooms>	
<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>	
</Room>	
<Room>		
<RoomSerial>3</RoomSerial>		
<Adults>3</Adults>		
<Child>		
</Child>	
</Room>	
<CurrencyID>162</CurrencyID>
</HotelsParameters>
i am trying to get the result by posting HotelData but i did not get the xml result file
so can anyone help me
i will post my code in next thread
john_zakaria is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-02-2010, 04:33 AM my code is
Skilled Talker

Posts: 97
Trades: 0
my code is :
PHP Code:
<?
include('lib/nusoap.php');
class 
myClass {
  var 
$HotelData;
  function 
myClass() 
  {
   
$this->HotelData '<CityID>388</CityID>    <UserName>admin</UserName>    <UserPassword>admin</UserPassword>    <DateFrom>4/12/2010</DateFrom>    <DateTo>4/13/2010</DateTo>    <NumberOfRooms>2</NumberOfRooms>    <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>    </Room>    <Room>        <RoomSerial>3</RoomSerial>        <Adults>3</Adults>        <Child>        </Child>    </Room>    <CurrencyID>162</CurrencyID>';
  }
}

$data = new myClass();
$postdata http_build_query($data);

$opt['http']['method'] = "POST";
$opt['http']['header'] = "Content-type: application/x-www-form-urlencoded";
$opt['http']['content'] = $postdata;

$context stream_context_create($opt);

print 
$result file_get_contents("http://196.218.16.133/onlinereservation/service.asmx/HotelsSearch",false,$context);
$filename 'test.xml';
$somecontent $result;
unlink ('test.xml');
 
fopen('test.xml''w'); 
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

    
// In our example we're opening $filename in append mode.
    // The file pointer is at the bottom of the file hence
    // that's where $somecontent will go when we fwrite() it.
    
if (!$handle fopen($filename'a')) {
         echo 
"Cannot open file ($filename)";
         exit;
    }

    
// Write $somecontent to our opened file.
    
if (fwrite($handle$somecontent) === FALSE) {
        echo 
"Cannot write to file ($filename)";
        exit;
    }

   
// echo "Success, wrote ($somecontent) to file ($filename)";

    
fclose($handle);

} else {
    echo 
"The file $filename is not writable";
}
//header('location:get_data.php');
?>
john_zakaria is offline
Reply With Quote
View Public Profile
 
Old 05-02-2010, 05:24 AM Re: really i need help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
XML data has to be sent with a ContentType of xml not as a form.

You can't use file_getcontents to open POST data.

Your output script should send a datastream, just like RSS feeds do
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-02-2010, 05:29 AM Re: really i need help
Skilled Talker

Posts: 97
Trades: 0
Quote:
Originally Posted by chrishirst View Post
XML data has to be sent with a ContentType of xml not as a form.

You can't use file_getcontents to open POST data.

Your output script should send a datastream, just like RSS feeds do
Sorry could you please explain more.. or can you send me a sample??
john_zakaria is offline
Reply With Quote
View Public Profile
 
Old 05-02-2010, 06:37 AM Re: really i need help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://articles.techrepublic.com.com...1-5035149.html

You'll need to create yourself a membership (free)
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-03-2010, 03:27 AM Re: really i need help
Skilled Talker

Posts: 97
Trades: 0
Quote:
Originally Posted by chrishirst View Post
http://articles.techrepublic.com.com...1-5035149.html

You'll need to create yourself a membership (free)
Sorry Mr. chrishirst i looked at your link but i need more information for how to get the result or how to deal with this web service coz it made me crazy
john_zakaria is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to really i need help
 

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.86120 seconds with 12 queries