phpvms/app/Console/Commands/TestApi.php
2018-02-20 22:33:09 -06:00

31 lines
673 B
PHP

<?php
namespace App\Console\Commands;
use App\Console\BaseCommand;
use GuzzleHttp\Client;
class TestApi extends BaseCommand
{
protected $signature = 'phpvms:test-api {apikey} {url}';
protected $httpClient;
/**
* Run dev related commands
*/
public function handle()
{
$this->httpClient = new Client([
'headers' => [
'Authorization' => $this->argument('apikey'),
'Content-type' => 'application/json',
'X-API-Key' => $this->argument('apikey'),
]
]);
$result = $this->httpClient->get($this->argument('url'));
echo $result->getBody();
}
}