logifuture with proxy wip
This commit is contained in:
1 parent
a96abae35a
commit
2e57e49f08
19 files changed
+196
-77
No files matched your search
@@ -4,38 +4,33 @@ namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
class Auth
|
||||
{
|
||||
public static $pass = 'nuhodds';
|
||||
public static $password;
|
||||
|
||||
public static function exe()
|
||||
{
|
||||
$base_url = BaseUrl::get();
|
||||
|
||||
$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,
|
||||
],
|
||||
$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',
|
||||
]);
|
||||
|
||||
if (! is_array($data)) {
|
||||
$file = curl_exec($ch);
|
||||
|
||||
Notice::note('no data sleep(60)', 'r');
|
||||
sleep(60);
|
||||
$data = json_decode($file, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$header = $data;
|
||||
$header[] = 'Authorization: Bearer '.$data['token'];
|
||||
$header[] = 'accept: application/json';
|
||||
$header[] = 'content-type: application/json';
|
||||
|
||||
return $header;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user