-1

How to send curl request in header .Please check this request and let me know how to implement this curl url and get the product details.

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"
Federkun
  • 30,933
  • 8
  • 62
  • 80
afzylive
  • 21
  • 5
  • Do you mean how to send a header in a curl request? If so, see [http://stackoverflow.com/questions/356705/how-to-send-a-header-using-a-http-request-through-a-curl-call](http://stackoverflow.com/questions/356705/how-to-send-a-header-using-a-http-request-through-a-curl-call) – Shawn Mehan Oct 03 '15 at 18:17

1 Answers1

0

This is how you would implement it in plain php ($response is the json response of snapdeal then):

<?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);
Dennis Stücken
  • 1,068
  • 8
  • 10