這是你將如何實現它在純PHP($響應snapdeal的JSON響應,那麼):
<?php
/**
* curl -H "Snapdeal-Affiliate-Id:aaaaa" -H "Snapdeal-Token-Id:bbbbb"
* "affiliate-feeds.snapdeal.com/feed/api/category/v1:586:1461823?expiresAt=1441751400001&signature=cvtwgjgrrbozmumlaalg" -H "Accept:application/json"
*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "affiliate-feeds.snapdeal.com/feed/api/category/v1:586:1461823?expiresAt=1441751400001&signature=cvtwgjgrrbozmumlaalg");
curl_setopt(
$ch, CURLOPT_HTTPHEADER,
array(
'Snapdeal-Affiliate-Id:aaaaa',
'Snapdeal-Token-Id:bbbbb',
'Accept:application/json'
)
);
$response = curl_exec($ch);
curl_close($ch);
// work with $response here:
$data = json_decode($response);
你的意思是如何在一個捲曲的請求發送一個頭?如果是這樣,請參閱[http://stackoverflow.com/questions/356705/how-to-send-a-header-using-a-http-request-through-a-curl-call](http://stackoverflow。 COM /問題/ 356705 /如何 - 發送 - 一個頭,使用-A-HTTP請求,通過-A-捲曲呼叫) –