我正在尝试使用网址
在帖子中发布此JSON $url = 'https://api.havail.sabre.com/v1.2.0/air/ticket';
$headers2 = array(
'Authorization: bearer '.$access_token,
'protocol: HTTP 1.1 ',
'Accept: */*',
"Content-Type: application/json"
);
$postData ='{
"AirTicketRQ": {
"DesignatePrinter": {
"Profile": {
"Number": 1
}
},
"Itinerary": {
"ID": "VWKJJT"
},
"Ticketing": [{
"FOP_Qualifiers": {
"BSP_Ticketing": {
"MultipleFOP": {
"Fare": {
"Amount": "100.00"
},
"FOP_One": {
"CC_Info": {
"Suppress": true,
"PaymentCard": {
"Code": "VI",
"ExpireDate": "2016-11",
"ExtendedPayment": 12,
"Number": ***********1003
}
}
},
"FOP_Two": {
"Type": "CK"
}
}
}
},
"PricingQualifiers": {
"PriceQuote": [{
"Record": [{
"Number": 1,
"Reissue": true
}]
}]
}
},
{
"FOP_Qualifiers": {
"BSP_Ticketing": {
"MultipleFOP": {
"Fare": {
"Amount": "100.00"
},
"FOP_One": {
"CC_Info": {
"Suppress": true,
"PaymentCard": {
"Code": "VI",
"ExpireDate": "2016-11",
"ExtendedPayment": 12,
"Number": ************1003
}
}
},
"FOP_Two": {
"Type": "CA"
}
}
}
},
"PricingQualifiers": {
"PriceQuote": [{
"Record": [{
"Number": 2,
"Reissue": true
}]
}]
}
}],
"PostProcessing": {
"EndTransaction": {
"Source": {
"ReceivedFrom": "SPTEST"
}
}
}
}
}';
$ch2 = curl_init();
curl_setopt($ch2,CURLOPT_HTTPHEADER,$headers2);
curl_setopt($ch2, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, POST);
curl_setopt($ch2, CURLOPT_POSTFIELDS, $postData);
//curl_setopt($curl_handle, CURLOPT_HTTPGET, TRUE);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//var_dump( $results = json_decode(curl_exec($ch2)));
$results["get_data"] = json_decode(curl_exec($ch2),true);
我尝试将GET方法用于其他API并且它正在运行。但对于增强型机票,我收到了错误的数据。
第一部分:
什么是打印机错误。我使用了一些有效的API,但为什么这个API显示出这些问题呢?实际问题是什么?我的JSON是否正确,我在请求中发送?
答案 0 :(得分:0)
问题在于这部分代码:
"DesignatePrinter": {
"Profile": {
"Number": 1
}
},
如果以前这样做,你可能是在不同的环境或PCC中完成的。