I'm trying to integrate an API, and in the API integration instructions, it shows the following:
GET /offers.json or /offers.xml Headers: API-KEY={your_key}, API-LOGIN={your_login}
CURL example:
curl https://api.thewebsite.com/v1/offers.json -H 'API-KEY: 1a2b3c4d5e6f7g8h9i' -H 'API-LOGIN: 1a2b3c4d5e6f7g8h9i'
I tried using the cURL code below without success. As for the GET method, I'm not sure how to pass the KEY API and LOGIN API as headers.
$header = array('Content-Type: application/xml', 'API-KEY=1a2b3c4d5e6f7g8h9i', 'API-LOGIN=1a2b3c4d5e6f7g8h9i'); $url = "https://api.thewebsite.com/v1/offers.xml"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); $xml = curl_exec($curl); curl_close($curl); print $xml;
source share