siip-whatsapp-notifications.../test_script2.php

15 lines
626 B
PHP
Executable File

<?php
require_once __DIR__ . '/vendor/autoload.php';
$options = [
'base_uri' => 'https://localhost/crm/api/v1.0/',
'verify' => false,
'headers' => [
'X-Auth-App-Key' => json_decode(file_get_contents(__DIR__ . '/data/config.json'), true)['apitoken'],
'Content-Type' => 'application/json'
]
];
$client = new \GuzzleHttp\Client($options);
$response = $client->get('payments?limit=10&direction=DESC');
$payments = json_decode($response->getBody()->getContents(), true);
print_r(array_map(function($p) { return ['id' => $p['id'], 'methodId' => $p['methodId'], 'note' => $p['note']]; }, $payments));