public function send($url, $parameters, $method = 'post')
{
try {
$client = new HttpClient();
$headers = ['Accept' => 'application/json'];
switch ($method) {
case 'post':
$request = $client->post($url, $headers, $parameters);
break;
case 'get':
$request = $client->get($url, $headers, $parameters);
break;
default:
throw new \Exception('Invalid HTTP method');
}
return json_decode((string) $request->send()->getBody(), true);
} catch (\Exception $e) {
$this->logger->error($e->getMessage());
return false;
}
}