[英]How to use Hub API using Curl in php
我已經從RouteHappy網站購買了Hub API,用於使用“來源”和“目的地”進行搜索航班。
他們給我下面使用API的代碼
curl \
-H "Auth: YOUR_API_KEY" \
-H "Accept: application/vnd.api.v3+json" \
-G \
-d ids=DSM-ORD-AA-3558-20160907-FIRST \
-d include=seat,wifi \
YOUR_HOST/segments
但是我無法使用PHP,Laravel中的Curl使用Flight API。請幫助我訪問API並獲得期望的結果。
echo (new hhb_curl ( '', true ))->setopt_array ( array (
CURLOPT_URL => 'YOUR_HOST/segments',
CURLOPT_HTTPHEADER => array (
"Auth: YOUR_API_KEY",
"Accept: application/vnd.api.v3+json"
),
CURLOPT_POSTFIELDS => http_build_query ( array (
'ids' => 'DSM-ORD-AA-3558-20160907-FIRST',
'include' => 'seat,wifi'
) )
) )->exec ()->getStdOut ();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.