Travelport / travelport-uapi-tutorial-php

The travelport-uapi-tutorial-php is a PHP project for Universal API that will help you connect and code a standard workflow including Air, Vehicle, and Hotel.
35 stars 47 forks source link

Error For Booking #190

Closed imon91 closed 5 years ago

imon91 commented 5 years ago

Hello I have got this error when I tried to book would you check it please response

tttt1

` <?php

$TARGETBRANCH = 'P3018376'; $CREDENTIALS = 'Universal API/uAPI3479047859-dfa41a9b:tL+9P4o_cE'; $PROVIDER = '1G'; // Any provider you want to use like 1G/1P/1V/ACH //$PreferredDepDate = date('2019-03-30', strtotime("75 day"));

$message = <<<EOM

Bangladesh new palasia indore mp 452001 BD indore new palasia indore Dhaka 121 BD gws-eJxNTkEOg0AIfIyZ+4BttLddWbVJ0720Hrz0/88orDUpCczAkIGUklJuFGX6jw6fblpRNwMq1NNsw+VKQrzZQXLEYyr9E82g19HntWkHStsymdUBiyw8pAjsrZZsYdRsHQVxFkF9gJPMd6c1l3d+SZz1Rf4kDvAvv6XVKgk= gws-eJxNTssKwzAM+5iiu+w1pL2lpAnrJZTSDHrZ/3/GnHSDGWzJll8hBKXMFGX4twHvYdlQagQK1HxbD4i42ffsgo0k1LTv6AseOlm5dOlGaU3MzGqArJm31AxXjzFW00TH0RlS0M6iUZvAj6Sn0bKsJ1Utn6hO/Osr0sP+/AAibyrI gws-eJxNTssKwzAM+5iiu+wsy3ZLSRPWSyhjGfSy//+MOWkHM9iSLb9ijEq5U5Tx3yZ8pnlFbQmoUPOUGoTXEOAs22EjGS1vG8aCi6OV65AOlN7EwqIGKFo4pL2anXFdnqaJePWGFPSz6NQm8CP5YbTOy4uqlt+o3oX3KTLA/vwCIOYqzA== gws-eJxNTkEOwkAIfEwz92G7Rr3tlm01MXLRHnrx/8+QpTWRBGZgyEApJVGulMTyHwM+w3SDrQoYkmerinwikb3ZQPKCx9TGJ8Igj/S5hbajxJbKnBywyMKQNvM4qurajcLWUdDPolMf4Efmu1Or7V1f0s/6Ig+JZ/iXX6IHKhE= gws-eJxNTssKwzAM+5iiu+0mZL2lpAnrJZSxDHrZ/3/GlKyDGWzJll8xRhNdRE3iv014T+uO2hJQYfSUGlT9EjAzO8GRjJaPA2OBm4XlOqQvam+SIsUIKFZkSGelXXHfHtTUnPNEUfSz6JQT+JF8J63r9hQz5jcxr+F1iRLAPz8idCrO gws-eJxNTkEOg0AIfIyZ+7DV2N52ZdUmTbm0Hrz0/88oizYpCczAkIGcc6LcKIn5Pzp8ummFbQoYkmctin4g0Xuzg+QVj6lengiDgeJzC+1AiS2VOTlgkYUh7eZxVtWtGYWto6CdRaM+wI/Md6dW6ru8pJ31RZ4SR/iXX6GMKhA= DAC BG CCU 45.00KBD3M AI X/BOM Q4.24 AI IDR Q4.24 115.97UEPP AI X/DEL Q4.24 AI CCU Q4.24 106.77UEPP BG DAC 45.00KBD3M NUC329.70END ROE1.0 MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG 2P BAGGAGE DISCOUNTS MAY APPLY BASED ON FREQUENT FLYER STATUS/ ONLINE CHECKIN/FORM OF PAYMENT/MILITARY/ETC. BAGGAGE CHARGES DATA NOT AVAILABLE BAGGAGE CHARGES DATA NOT AVAILABLE CARRY ON ALLOWANCE DATA NOT AVAILABLE MYTRIPANDMORE.COM/BAGGAGEDETAILSQF.BAGG EOM; $file = "003-".$PROVIDER."_FlightBookReq.xml"; // file name to save the request xml for test only(if you want to save the request/response) prettyPrint($message,$file); //Calling the Pretty Print function // // Run the request // $auth = base64_encode("$CREDENTIALS"); $soap_do = curl_init("https://americas.universal-api.travelport.com/B2BGateway/connect/uAPI/AirService"); /*("https://americas.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService");*/ $header = array( "Content-Type: text/xml;charset=UTF-8", "Accept-Encoding: gzip,deflate", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: \"\"", "Authorization: Basic $auth", "Content-length: ".strlen($message), ); //curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 30); //curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_ENCODING, ''); $return = curl_exec($soap_do); curl_close($soap_do); $file = "001-".$PROVIDER."_FlightBookRsp.xml"; // file name to save the response xml for test only(if you want to save the request/response) $content = prettyPrint($return,$file); parseDetailOutput($content); function prettyPrint($result,$file){ $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->loadXML($result); $dom->formatOutput = true; //call function to write request/response in file outputWriter($file,$dom->saveXML()); return $dom->saveXML(); } function outputWriter($file,$content){ file_put_contents($file, $content); // Write request/response and save them in the File } //Parse the previous response to get the values to populate Request xml function parseDetailOutput($content){ //$hotelDetailRsp = file_get_contents('002_HotelDetailRsp.xml'); // Parsing the Hotel Detail Response xml $hotelDetailRsp = $content; //use this if response is not saved anywhere else use above variable $xml = simplexml_load_String("$hotelDetailRsp", null, null, 'SOAP', true); if(!$xml) { header("Location: http://LocationOfErrorPage/projects/Hotel/error.php"); // Use the location of the error page } $Results = $xml->children('SOAP',true); foreach($Results->children('SOAP',true) as $fault){ if(strcmp($fault->getName(),'Fault') == 0){ //trigger_error("Error occurred request processing!", E_USER_ERROR); header("Location: http://LocationOfErrorPage/projects/Hotel/error.php"); // Use the location of the error page } } foreach($Results->children('flight',true) as $nodes){ foreach($nodes->children('flight',true) as $hsr){ if(strcmp($hsr->getName(),'RequestedHotelDetails') == 0){ foreach($hsr->children('flight',true) as $hp){ if(strcmp($hp->getName(),'FlightProperty') == 0){ foreach($hp->attributes() as $a => $b ){ $GLOBALS[$a] = "$b"; } $COUNT = 0; $Address = 'Address'; foreach($hp->children('flight',true) as $pa){ if(strcmp($pa->getName(),'PropertyAddress') == 0){ foreach($pa->children('flight',true) as $ha){ if(strcmp($ha->getName(),'Address') == 0){ $GLOBALS[$Address.$COUNT++] = $ha[0]; } } } } } } foreach($hsr->children('flight',true) as $hp){ if(strcmp($hp->getName(),'FlightRateDetail') == 0){ foreach($hp->attributes() as $a => $b ){ $GLOBALS[$a] = "$b"; } break; } } } break; } } } //call function to write output in a file // // Official PHP CURL manual; http://php.net/manual/en/book.curl.php // ?> `
vivekjyotipramanik commented 5 years ago

Hi @imon91,

Please share the full error message. The screenshot is not showing the full error message. Thanks.

imon91 commented 5 years ago

Hello vivekjyotipramanik Solved it Thanks

akv0204 commented 5 years ago

Hello Vivek, Could you please enable robotic sign-on for following credentials - ID: Universal API/uAPI8383229630-d0cbb10b Target Branch: P7039096 Provider: 1G

-- Thanks & Regards, Ajay

NirandaG commented 5 years ago

Hi, This has been created. Could you please try now? Rgds, Niranda