56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper\Logifuture;
|
|
|
|
class Auth
|
|
{
|
|
public static $password;
|
|
|
|
public static function exe()
|
|
{
|
|
|
|
$base_url = BaseUrl::get();
|
|
|
|
$url = $base_url.'/v1/authentication/token';
|
|
|
|
if (config('env.app_env') == 'local') {
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, 'https://proxydb1.nuhodds.com/proxy.php');
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
|
'url' => $url,
|
|
'password' => self::$password,
|
|
]);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
|
]);
|
|
} else {
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
|
'username' => 'nuhodds',
|
|
'password' => self::$password,
|
|
]));
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
'accept: application/json',
|
|
'content-type: application/json',
|
|
]);
|
|
}
|
|
$file = curl_exec($ch);
|
|
|
|
$data = json_decode($file, true);
|
|
|
|
dd($data);
|
|
|
|
return $data;
|
|
}
|
|
}
|