forked from tme-dev/api-client-guzzle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
37 lines (29 loc) · 828 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
// Register your app here https://developers.tme.eu/en/dev
const TOKEN = '';
const SECRET = '';
require 'vendor/autoload.php';
$credentials = new \TMEApi\Hmac\Credentials(TOKEN, SECRET);
$middleware = new \TMEApi\Hmac\HmacSignMiddleware($credentials);
// Register the middleware.
$stack = HandlerStack::create();
$stack->push($middleware);
// Create a Guzzle client.
$client = new Client([
'handler' => $stack,
]);
// Send request
$options = [
'form_params' => [
'SymbolList' => [
'NE555D',
'1N4007-DIO'
],
'Country' => 'US',
'Language' => 'EN',
],
];
$result = $client->request('POST', 'https://api.tme.eu/Products/GetProducts.json', $options);
print_r(json_decode($result->getBody(), true));