shrishail - 2011-07-06 05:34:39
Hi,
Very helpful Class RestClient.Class.php......!
I am using RestClient.Class.php for consuming cleartrip.com restful webservices.
I have done searching for flight service correctly.Now I am trying to get next service i.e creat itinerary. But I am getting error message "Not authorized to access the service".
Here is the link for cleartrip api doc.
http://www.cleartrip.com/api
and the code is
<?php
include 'webservices/RestClient.class.php';
include "webservices/xmltoassoc.php";
$arrinput=array ( "itinerary" => array ( "cabin-type" => E,
"flights" => array ( "flight-spec" => array (
0 => array ( "fare-key" => 'supp_INDIGO|si-1d226b84-15dc-465e-815e-5948db6024b4|fk_6E_182_1309880400000_K1BOMDEL_true__fpr_9027',"segments" => array ( "segment-spec" => array ( "departure-airport" => 'BOM', "arrival-airport" => 'DEL' ,"flight-number" => 182, "airline" => '6E' ,"operating-airline" => '6E' ,"departure-date" => '2011-07-05' ) ) ),
1 => array ( "fare-key" => 'supp_INDIGO|si-1d226b84-15dc-465e-815e-5948db6024b4|fk_6E_212_1309926600000_K1BOMDEL_true__fpr_7523' ,"segments" => array ( "segment-spec" => array ( "departure-airport" => 'DEL', "arrival-airport" => 'BOM' ,"flight-number" => 212, "airline" => '6E' ,"operating-airline" => '6E' ,"departure-date" => '2011-07-06' ) ) ) ) ),
"pax-info-list" => array ( "pax-info" => array ( 0 => array ( "title" => 'Mr' ,"first-name" => 'Nikhil',"last-name" => 'Prabhakar' ,"type" => 'ADT' ),1 => array ( "title" => 'Mstr' ,"first-name" => 'Chaitanya' ,"last-name" => 'Gupta' ,"type" => 'CHD' ,"date-of-birth" => '2007-05-05' ) ) ),
"contact-detail" => array ( "title" => 'Mr' ,"first-name" => 'Nikhil' ,"last-name" => 'Prabhakar' ,"email" => 'noreply.test@cleartrip.com', "address" => 'Lower Parel, Mumbai', "mobile" => 919810000000 ,"landline" => 912240554225 ,"city-name" => 'Mumbai' ,"state-name" => 'Maharashtra' ,"country-name" => 'India' ,"pin-code" => 400011 ),
"payment-detail" => array ( "payment-type" =>'CC' ,"card-detail" => array ( "card-number" => 999999999,"card-expiry-date" => '2025-01',"card-cvv" => 733 ,"card-type" => 'AMEX' ,"card-holder-name" => 'Don Juan' ,"billing-address" => array ( "first-name" => 'Cleartrip' ,"last-name" => 'Travels' ,"address" => 'Lower Parel' ,"city-name" => 'Mumbai' ,"state-name" => 'Maharashtra' ,"country-name" => 'india' ,"pin-code" => 400005 ) ) ) ),
"itinerary_attr" => array ( "xmlns" => 'http://api.staging.cleartrip.com/air/' ) );
$restclient = RestClient::post("http://api.staging.cleartrip.com/air/1.0/itinerary/create",$arrinput);
$response=$restclient->getResponse();
$reader = new XMLReader();
$reader->XML($response);
$content = xml2array($response);
print_r($content);
?>
Please suggest me, how to solve this problem.
Thanks and regards,
Shrishail