PDA

View Full Version : form to update xml query


alan
03-29-2010, 09:39 AM
Hi im a newbie to xml and im having problems creating a form to put on my web page for a user to search my xml feed.

i have this code


<?php

$XPost=
'<?xml version="1.0" encoding="UTF8" ?>
<GethotelAvail>
<Username>my username</Username>
<Password>my password</Password>
<Lang>EN</Lang>
<DestinationID></DestinationID>
<ResortID></ResortID>
<HotelID></HotelID>
<RoomID></RoomID>
<Meal></Meal>
<CheckIn></CheckIn>
<CheckOut></CheckOut>
<Rooms></Rooms>
<Adults></Adults>
<Children>0</Children>
<Infants></Infants>
<SortBy>Price</SortBy>
<SortOrder>ASC</SortOrder>
</GethotelAvail>';
$ch =
curl_init('http://url_for_xml_request.php?'.'xml='.urlencode($XPost))
;
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$responseInfo=curl_getinfo($ch);
curl_close($ch);


?>


i need to put a form on my web page that will update all the fields (except username and password) and submit the search to my xml feed.

after lots of looking around i thought i could just pass a php form variable to this script and it would run, however after trying different ways i cannot get it to search correctly.
any guidance or examples on this would be much appreciated.

many thanks in advance

al