Skip to content

Instantly share code, notes, and snippets.

@nidup
Last active March 12, 2017 15:33
Show Gist options
  • Save nidup/c22e0c4eeb4f22f0ea906a291ec213a2 to your computer and use it in GitHub Desktop.
Save nidup/c22e0c4eeb4f22f0ea906a291ec213a2 to your computer and use it in GitHub Desktop.
Akeneo Web API, get products
<?php
$host = "http://pim-ce-17-odm.local/app_dev.php/";
$url = $host."api/rest/v1/products";
$tokenType = "Bearer";
$accessToken = "M2IzMTFlYTE0MDZjNTc4YTlhNjNiY2I4MTdhYTRhNTMxMjlkY2FhYWRiYWM3MjMyMTgzZjdmZTIyMDExMDk1Yw";
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: '.$tokenType.' '.$accessToken;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment