Closed yousufkhan6361 closed 5 years ago
here is my file : <?php /*
This code is for illustration purposes only. _/ $TARGETBRANCH = 'P7009857'; $CREDENTIALS = 'use username and password in the welcome letter'; $Provider = '1G'; $message = <<<EOM
Hi yousufkhan6361,
Could you please confirm if you changed the TargetBranch/username and password before running the code. Thanks.
Thanks & Regards Vivekjyoti Pramanik
Yes i have changed the username and password as well
Hi yousufkhan6361,
Please change AirService to UtilService in the Endpoint URL. As ReferenceDataRetrieve is part of Util Schema. Please let me know how it goes. Thanks.
Thanks & Regards Vivekjyoti Pramanik
ok i checked it now it is working fantastic
thank you so much vivekjyoti ... i have a question that where i put the origin and destination fields name which comes from my website form
because on my website html form fields i have to call an onchange javascript event and sett css as it print the response like as in demo site https://demo.travelportuniversalapi.com/Home
ok ok now i understand please let me correct if i m wrong i have got file of data search recrord in microsoft exel file i get all the record from that file and display it on my project file using javascript html and css .....
Hi yousufkhan6361,
You are correct! It can be an excel or a csv or a Database table. Thanks.
Thanks & Regards Vivekjyoti Pramanik
;Thanks a lot vivekjyoti .... and please tell me that i have done lowfaresearch and autocomplete data search today and now i have to do Airbooking and generated pnr no am i right .......
because my project requirement is :
Hi yousufkhan6361,
The flow is Search -> Air price -> Air Book -> Air Ticket. During Air Book it will generate the PNR and other confirmed details. Although it will just hold the flight during Book. To confirm it, you have to do ticketing. The AirTicketing step will generate Ticket Number.
Now, before you do ticketing it is mandatory to have a Virtual Ticketing Printer assigned to your PCC/TargetBranch by Travelport. Without the printer you would not be able to ticket the Flight/Itinerary. The ticketing printer can only be assigned by the Travelport Account Manager. Once you sign a contract with Travelport you will be assigned the ticketing printer.
If you already signed a contract with Travelport, Please ask your Travelport Account Manager for the Ticketing printer. If you do not have any contract and want to sign a contract, Please provide me your company details, contact number etc. and we will have someone from Sales team contact you regarding the procedure.
Please let me know how it goes. Thanks.
Thanks & Regards Vivekjyoti Pramanik
ok vivekjyoti ! i let you know .... thanks regards yousufkhan6361
Hi vivekjyoti how r you ! i have a question about ReferenceDataRetrieve ... as you sent me before a file of ReferenceDataRetrieve and its working very well everything is fine but it returns only airport names not cities name so how i get cities names as well because user will search the city an origin and destination fields kindly tell me i m waiting for your response ..... Thank You Have a nice day ! Regards : Yousuf Khan
ok i got it sorry ..... there is also a name of cities with the airport code you dont need to answere of this question .......
Hi Vivekjyoti ! i want to ask a question about ReferenceDataRetrieve beacause i have some difficulty to get data from file where ReferenceDataRetrieve response is coming (cities and codes ) and integrate into Css ,Html and php , so is it possible that i use Google place api (place autocomplete ) instead of ReferenceDataRetrieve beacuse in google places api there is also a cities and codes comes in response ..... Thanks Regards : yousufkhan
Hi yousufkhan6361,
As it is your website, you can use any API you want. Thanks.
Thanks & Regards Vivekjyoti Pramanik
ok i got it thanks a lot ..... Regards : Yousufkhan
Hi Vivekjyoti ! can you tell the work flow of Air Book which things required for Air Booking how it goes and how can i get the PNR number in the mail ...
Hi yousufkhan6361,
The flow starts from the AirShop either using AirAvailabilitySearchReq or LowFareSearchReq. For AirAvailabilitySearchReq, you will receive AirAvailabiltySearchRsp and for LowFareSearchReq, you will receive LowFareSearchRsp. From the response you will select one or more AirSegments and price the itinerary using AirPriceReq. AirPriceReq will respond with AirPriceRsp.
From the AirPriceRsp we can use the selected AirPricingSolution and use the AirPricingSolution in the AirCreateReservationReq.
You can provide all the BookingTraveler details in the AirCreateReservationReq. As a response you will receive AirCreateReservationRsp and all the details about the booking like PNR, UniversalRecordLocatorCode etc.
The PNR will be inside tag ProviderReservationInfo as LocatorCode.
After booking is complete, you can do AirTicketingReq to confirm the booking and generate the ticketnumber.
You can use UniversalRecordRetrieveReq any time after booking to retrieve all the details like PNR, UR, TicketNumber etc.
AirAvailability/LowFareSearch -> AirPrice -> AirCreate -> AirTicket -> UniversalRecordRetrieve
Please let me know how it goes. Thanks.
Thanks & Regards Vivekjyoti Pramanik
Hi Vivekjyoti ! i will not do AirTicket , i will do just till AirBooking and generate PNR no let me tell you my flow of working ..... i do first LowFareSearch and in LowFareSearch i got flights as well as prices and now i have to do just AirBooking or AirCreate and get PNR no if you have any link or code regarding AirBook or AirCreate please do share with me ..... can you tell me that is there any difference in AirCreate and AirBook ..... Thanks and Regards YousufKhan6361
Hi yousufkhan6361,
There is no difference between AirCreate or AirBook.
Just to add, without AirTicket the booking is not confirmed and after the ActionStatus/TicketDate passed, the booking will be cancelled automatically. As part of AirCreate/AirBook the booking is just being held until specified 'TicketDate'.
Please let me know how it goes. Thanks.
Thanks & Regards Vivekjyoti Pramanik
Hi Vivekjyoti ! ya i know actually when we got the PNR no then before specified date person has to go personally for ticketing i just got the PNR no by AirCreate or AirBook ...... can you send mei the link or code that how can i do AirBook and how i get Pnr number .... thanks a lot .... Regards Yousufkhan6361
Hi Yousufkhan6361,
Please find below the sample xml transaction to do a booking. As you can see in the response xml, there is a tag universal:ProviderReservationInfo. Inside the tag, the attribute LocatorCode can be found and that is the PNR. Please let me know how it goes. Thanks.
Request:
https://support.travelport.com/webhelp/uapi/Content/SampleWeb/SampleFiles/024-03_1G_AirBook_Rq.xml
Response:
https://support.travelport.com/webhelp/uapi/Content/SampleWeb/SampleFiles/024-03_1G_AirBook_Rs.xml
Thanks & Regards Vivekjyoti Pramanik
ok Thanks .... do you have these files in php code ?
Hi Yousufkhan6361,
We do not have any readily available Booking Sample on PHP. Thanks.
Thanks & Regards Vivekjyoti Pramanik
ok i try to integrate it into php .... In the AirBook Req there is com:ShippingAddress com:Address and other things like total price and departuretime arrival time branch code i know that on these variables i have to print the result which i got from LowFareSearch response but in com:ShippingAddress com:Address i think i have to give information on these section which persone will give into the website form like Name,State,City etc am i right .......
Hi yousufkhan6361,
The pricing related details can be retrieved from AirPriceRsp. The details about bookingTraveler, like name, shippingAddress, deliveryaddress etc details should be provide by Traveler. Thanks.
Thanks & Regards Vivekjyoti Pramanik
as i use LowFareSearch i also get price or total price flight no etc so i give that info to AirBook Req ?
i just want to ask that what things i have to give my self in AirBook Req ?
Hi yousufkhan6361,
LowFareSearchRsp provides pricing details, but it is recommended to do a AirPrice before doing AirBook, as AirPrice provides more details and more up to date data.
Please find below the link which discusses about the required elements to be provided in AirBooking. Please let me know how it goes. Thanks.
Thanks & Regards Vivekjyoti Pramanik
ok than after Low FareSearch i will do AirPrice if you have xml or php file of AirPrice Req/Res please do share with me thanks a lot ......
Hi Vivekjyoti ! can you please send me the xml(code) or php files of Air Pricing .......... Thanks and Regards yousufkhan
Hi yousufkhan6361,
Please find below the details regarding AirPrice. Please find below the sample request and response. Please let me know how it goes. Thanks.
Request:
https://support.travelport.com/webhelp/uapi/Content/SampleWeb/SampleFiles/001-02_1G_AirPrice_Rq.xml
Response:
https://support.travelport.com/webhelp/uapi/Content/SampleWeb/SampleFiles/001-02_1G_AirPrice_Rs.xml
Thanks & Regards Vivekjyoti Pramanik
Hi Vivekjyoti ! In LowFareSearch we got a file flights.txt ok ... but i want this file in json format or xml how can i get it ..... Thanks and Regards yousufkhan
Hi yousufkhan6361,
We have parsed the response using PHP as shown in the code and added the response accordingly to the flights.txt. This was done for demo purposes only. If you removed the parsing code, you will receive the response in XML only. If you run the code you will get the req xml and rsp xml anyway. Please check the folder from where the php file is being run.
To get it in JSON , you will have to parse the XML and instead of txt file you have to put it in JSON format.
Please let me know how it goes. Thanks.
Thanks & Regards Vivekjyoti Pramanik
Hi Vivekjyoti ! while parsing air pricing for getting response i get following error in response file
<faultstring>000280 FLIGHT NOT FOUND - CHECK AVAILABILITY </faultstring>
<detail>
<common_v34_0:ErrorInfo xmlns:common_v34_0="http://www.travelport.com/schema/common_v34_0">
<common_v34_0:Code>3100</common_v34_0:Code>
<common_v34_0:Service>WEBSVC</common_v34_0:Service>
<common_v34_0:Type>System</common_v34_0:Type>
<common_v34_0:Description>General Failure:(Unmapped error): 000280</common_v34_0:Description>
<common_v34_0:TransactionId>2A89F8390A07643C96CF0247B34EC3C5</common_v34_0:TransactionId>
<common_v34_0:TraceId>trace</common_v34_0:TraceId>
</common_v34_0:ErrorInfo>
</detail>
/SOAP:Fault
here is my code <?php /*
function ListAirSegments($key, $lowFare){
foreach($lowFare->children('air',true) as $airSegmentList){
if(strcmp($airSegmentList->getName(),'AirSegmentList') == 0){
foreach($airSegmentList->children('air', true) as $airSegment){
if(strcmp($airSegment->getName(),'AirSegment') == 0){
foreach($airSegment->attributes() as $a => $b){
if(strcmp($a,'Key') == 0){
if(strcmp($b, $key) == 0){
return $airSegment;
}
}
}
}
}
}
}
}
function parseOutput($content){ //parse the Search response to get values to use in detail request
$AirPrice_Rs = $content; //use this if response is not saved anywhere else use above variable
//echo $LowFareSearchRsp;
$xml = simplexml_load_String("$AirPrice_Rs", null, null, 'SOAP', true);
//print_r( $xml);
if($xml)
echo "Processing! Please wait!";
else{
trigger_error("Encoding Error!", E_USER_ERROR);
}
$Results = $xml->children('SOAP',true);
print_r($Results);
die();
foreach($Results->children('SOAP',true) as $fault){
if(strcmp($fault->getName(),'Fault') == 0){
trigger_error("Error occurred request/response processing!", E_USER_ERROR);
}
}
$count = 0;
$fileName = "flights.txt";
if(file_exists($fileName)){
file_put_contents($fileName, "");
}
foreach($Results->children('air',true) as $lowFare){
foreach($lowFare->children('air',true) as $airPriceSol){
if(strcmp($airPriceSol->getName(),'AirPricingSolution') == 0){
$count = $count + 1;
file_put_contents($fileName, "Air Pricing Solutions Details ".$count.":\r\n", FILE_APPEND);
file_put_contents($fileName,"--------------------------------------\r\n", FILE_APPEND);
// foreach($airPriceSol->children('air',true) as $journey){}
foreach($airPriceSol->children('air',true) as $priceInfo){
if(strcmp($priceInfo->getName(),'AirPricingInfo') == 0){
file_put_contents($fileName,"\r\nPricing Details: ", FILE_APPEND);
file_put_contents($fileName,"\r\n", FILE_APPEND);
file_put_contents($fileName,"--------------------------------------\r\n", FILE_APPEND);
foreach($priceInfo->attributes() as $e => $f){
if(strcmp($e, "ApproximateBasePrice") == 0){
file_put_contents($fileName,"Approx. Base Price: ".$f."\r\n", FILE_APPEND);
}
if(strcmp($e, "ApproximateTaxes") == 0){
file_put_contents($fileName,"Approx. Taxes: ".$f."\r\n", FILE_APPEND);
}
if(strcmp($e, "ApproximateTotalPrice") == 0){
file_put_contents($fileName,"Approx. Total Price: ".$f."\r\n", FILE_APPEND);
}
if(strcmp($e, "BasePrice") == 0){
file_put_contents($fileName,"Base Price: ".$f."\r\n", FILE_APPEND);
}
if(strcmp($e, "Taxes") == 0){
file_put_contents($fileName,"Taxes: ".$f."\r\n", FILE_APPEND);
}
if(strcmp($e, "TotalPrice") == 0){
file_put_contents($fileName,"Total Price: ".$f."\r\n", FILE_APPEND);
}
}
}
}
file_put_contents($fileName,"\r\n", FILE_APPEND);
}
}
}
$Token = 'Token';
$TokenKey = 'TokenKey';
$fileName = "tokens.txt";
if(file_exists($fileName)){
file_put_contents($fileName, "");
}
foreach($Results->children('air',true) as $nodes){
foreach($nodes->children('air',true) as $hsr){
if(strcmp($hsr->getName(),'HostTokenList') == 0){
foreach($hsr->children('common_v29_0', true) as $ht){
if(strcmp($ht->getName(), 'HostToken') == 0){
$GLOBALS[$Token] = $ht[0];
foreach($ht->attributes() as $a => $b){
if(strcmp($a, 'Key') == 0){
file_put_contents($fileName,$TokenKey.":".$b."\r\n", FILE_APPEND);
}
}
file_put_contents($fileName,$Token.":".$ht[0]."\r\n", FILE_APPEND);
}
}
}
}
}
echo "\r\n"."Processing Done. Please check results in files.";
} ?>
Hi Vivekjyoti ! while parsing air pricing for getting response i get following error in response file Server.System 000280 FLIGHT NOT FOUND - CHECK AVAILABILITY
3100 WEBSVC System General Failure:(Unmapped error): 000280 2A89F8390A07643C96CF0247B34EC3C5 trace
Hi Vivekjyoti ! I got the response in php of Air pricing actually i used past date thats why got error now its working fine Thanks and Regards Yousufkhan
Hi Vivekjyoti ! here is the code of AirPriceReq ...
Hi Yousuf,
Apologies for the delayed response. I was in a conference this past week and could not answer the questions. I will look into the questions you have and will answer by today. Thanks.
Thanks & Regards Vivekjyoti Pramanik
Hi Yousuf,
To answer your question regarding return journey, we just need to add the return AirSegment in the request to get the complete AirPricing for return journey. Please find below the sample. Please let me know how it goes. Thanks.
Request:
https://support.travelport.com/webhelp/uapi/Content/SampleWeb/SampleFiles/024-02_1G_AirPrice_Rq.xml
Response:
https://support.travelport.com/webhelp/uapi/Content/SampleWeb/SampleFiles/024-02_1G_AirPrice_Rs.xml
Thanks & Regards Vivekjyoti Pramanik
Hi Vivekjyoti ! its ok ,and its so nice to see your answere you are very helpfull i did this and now its working fine thank you so much ... there is another issue that i am facing dont know what to do actually the issue is : I do LowFareSearch its working fine and get the response and parse it in to php successfully after that i did air pricing its also working fine and Airbooking is also working fine and give the right response but issue is when i got the LowFareSearch response i got the flights on my site than what i have to do i select any flight aur any segment than after i do air pricing but the problem is that any flight aur segment i select i want that flight info will go to the air pricing i dont know that which flight i select how i set that info into air pricing xml .....when i click the flight MAN to LCY than i want that i get air pricing of MAN to LCY but this time i add info my self in air pricing it not comes dynamically if you have any ideas so please do share with me ............ Thanks and Regards Yousufkhan
Hi Yousuf,
Could you please explain the question a bit more with an example. Thanks.
Thanks & Regards Vivekjyoti Pramanik
Hi Vivekjyoti ! I solved that issue ....... as you know that i m using trial version of travelport api and it will expired after some days now tell me how can i use this api credentials for long period what will be the process i dont want to use trial .... Thanks & Regards YousufKhan
Hi YousufKhan, If you are using the SANDBOX credentials, then you would have to Sign a contract with Travelport. Please contact your Travelport Account Manager and they will be able to help you setting this up with the contract. After signing a contract you will be getting the Pre-Production credentials that you can start the development with. If you need further information please let us know.
Thank you, B.Rgds, Niranda
Hi NirandaG ! i have a question about searching flights on particular date im using date for searching flights after three days but i got error and and when i use current date and set it to like this $going_date = date('Y-m-d', strtotime($PreferredDate. ' + 3 days')); $return_date123 = date('Y-m-d', strtotime($PreferredDateR. ' + 4 days')); when i use this then i got correct resopnse but like this three days added to selected date so i want to get flights on the exact date which user select and i do that user select three days after date and not adding days after so i did not got response (flights) ..... Thnaks and Regards Yousufkhan
Hi Yousufkhan,
The Flexi Dates shopping is a feature that is enabled with the contract of Travelport. I believe since you are having the Sandbox credentials this feature is not enabled.
Thank you, B.Rgds, Niranda
Hi NirandaG ! In LowFareSearch i got airline name but how can i get airline logo as well or how can i print airline logo with airline name because i just get an airline name if you have any idea do share with me ....
Thank you, Regards, Yousufkhan
Hi vivikjyoti ! https://github.com/Travelport/travelport-uapi-tutorial-php/tree/master/Util
i use this on my project and i got these errors
Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in C:\xampp\htdocs\pretty_planet\preetylast\travelport_api_test_files\reference_data_req\reference_data_search.php on line 63
Warning: simplexml_load_string(): Entity: line 2: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\pretty_planet\preetylast\travelport_api_test_files\reference_data_req\reference_data_search.php on line 75
Warning: simplexml_load_string(): in C:\xampp\htdocs\pretty_planet\preetylast\travelport_api_test_files\reference_data_req\reference_data_search.php on line 75
Warning: simplexml_load_string(): ^ in C:\xampp\htdocs\pretty_planet\preetylast\travelport_api_test_files\reference_data_req\reference_data_search.php on line 75
Fatal error: Encoding Error! in C:\xampp\htdocs\pretty_planet\preetylast\travelport_api_test_files\reference_data_req\reference_data_search.php on line 80