Logifuture proxy
This commit is contained in:
1 parent
a4bfecde02
commit
403cb8d08b
8 files changed
+135
-97
No files matched your search
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Authentication
|
||||
{
|
||||
public static $password;
|
||||
|
||||
public static function authenticate()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$url = Logifuture::$base_url.'/v1/authentication/token';
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH with PROXY'.PHP_EOL.$url, 'r');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_auth.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' => config('env.logifuture_token')]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH from PRODUCTION'.PHP_EOL.$url, 'r');
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
$header = [];
|
||||
$header[] = 'Authorization: Bearer '.$data['token'];
|
||||
$header[] = 'accept: application/json';
|
||||
$header[] = 'content-type: application/json';
|
||||
|
||||
Logifuture::$auth_header = $header;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
|
||||
class BaseUrl
|
||||
{
|
||||
public static function get()
|
||||
{
|
||||
$test = false;
|
||||
switch (Nuh::$options['provider_id']) {
|
||||
case 5:
|
||||
if ($test) {
|
||||
Auth::$password = 'nuhodds';
|
||||
$base_url = 'https://stg-external-api.bet9ja.com/external';
|
||||
} else {
|
||||
Auth::$password = 'uSwIqs!Y3eHrNbyH';
|
||||
$base_url = 'https://external-api.bet9ja.com/external';
|
||||
}
|
||||
|
||||
break;
|
||||
case 6:
|
||||
if ($test) {
|
||||
Auth::$password = 'nuhodds';
|
||||
$base_url = 'https://stg-external-api.yajuego.co/external';
|
||||
} else {
|
||||
$base_url = 'https://external-api.yajuego.co/external';
|
||||
Auth::$password = 'uSwIqs!Y3eHrNbyH';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $base_url;
|
||||
}
|
||||
}
|
||||
+30
-11
@@ -2,33 +2,52 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
class Auth
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class LogifutureData
|
||||
{
|
||||
public static $password;
|
||||
|
||||
public static function exe()
|
||||
public static function load($logifuture_sport_id)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$base_url = BaseUrl::get();
|
||||
|
||||
$url = $base_url.'/v1/authentication/token';
|
||||
$url = Logifuture::$base_url.'/v1/matches?sportId='.$logifuture_sport_id;
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA with PROXY'.PHP_EOL.$url, 'r');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://proxydb1.nuhodds.com/proxy.php');
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_data.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,
|
||||
'header' => json_encode(Logifuture::$auth_header),
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH from PRODUCTION'.PHP_EOL.$url, 'r');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
@@ -46,8 +65,8 @@ class Auth
|
||||
}
|
||||
$file = curl_exec($ch);
|
||||
|
||||
$data = json_decode($file, true);
|
||||
dd($file);
|
||||
|
||||
return $data;
|
||||
return json_decode($file, true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user