42 lines
922 B
PHP
42 lines
922 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper\Logifuture;
|
|
|
|
class Auth
|
|
{
|
|
public static $pass = 'nuhodds';
|
|
|
|
public static function exe()
|
|
{
|
|
$base_url = BaseUrl::get();
|
|
|
|
$url = $base_url.'/v1/authentication/token';
|
|
|
|
$data = Loader::curlLoader($url, [
|
|
'header' => [
|
|
'accept: application/json',
|
|
'content-type: application/json',
|
|
],
|
|
'post' => [
|
|
'username' => 'nuhodds',
|
|
'password' => self::$pass,
|
|
],
|
|
]);
|
|
|
|
if (! is_array($data)) {
|
|
|
|
Notice::note('no data sleep(60)', 'r');
|
|
sleep(60);
|
|
|
|
return false;
|
|
}
|
|
|
|
$header = $data;
|
|
$header[] = 'Authorization: Bearer '.$data['token'];
|
|
$header[] = 'accept: application/json';
|
|
$header[] = 'content-type: application/json';
|
|
|
|
return $header;
|
|
}
|
|
}
|