Logifuture proxy
This commit is contained in:
1 parent
a4bfecde02
commit
403cb8d08b
8 files changed
+134
-96
No files matched your search
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Auth;
|
||||
use App\Console\Commands\Grapper\Logifuture\BaseUrl;
|
||||
use App\Console\Commands\Grapper\Logifuture\Authentication;
|
||||
use App\Console\Commands\Grapper\Logifuture\Basketball;
|
||||
use App\Console\Commands\Grapper\Logifuture\Icehockey;
|
||||
use App\Console\Commands\Grapper\Logifuture\LogifutureData;
|
||||
use App\Console\Commands\Grapper\Logifuture\MapEvent;
|
||||
use App\Console\Commands\Grapper\Logifuture\Soccer;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tennis;
|
||||
@@ -19,10 +19,25 @@ use App\Utilities\Notice;
|
||||
|
||||
class Logifuture
|
||||
{
|
||||
public static $auth_header = [];
|
||||
|
||||
public static $base_url = '';
|
||||
|
||||
public static function switch()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
switch (Nuh::$options['provider_id']) {
|
||||
case 5:
|
||||
Nuh::$options['bookmaker_id'] = 35;
|
||||
self::$base_url = 'https://external-api.bet9ja.com/external';
|
||||
break;
|
||||
case 6:
|
||||
Nuh::$options['bookmaker_id'] = 36;
|
||||
self::$base_url = 'https://external-api.yajuego.co/external';
|
||||
break;
|
||||
}
|
||||
|
||||
$_elements = LoadElements::load(Nuh::$options['provider_id'], true);
|
||||
|
||||
$_groups = LoadGroups::load(Nuh::$options['provider_id'], true);
|
||||
@@ -35,50 +50,11 @@ class Logifuture
|
||||
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['sport']['name'], 'g');
|
||||
}
|
||||
|
||||
switch (Nuh::$options['provider_id']) {
|
||||
case 5:
|
||||
Nuh::$options['bookmaker_id'] = 35;
|
||||
break;
|
||||
case 6:
|
||||
Nuh::$options['bookmaker_id'] = 36;
|
||||
break;
|
||||
}
|
||||
Authentication::authenticate();
|
||||
|
||||
// https://external-api.bet9ja.com/external/v1/matches?sport_id=1
|
||||
// https://external-api.bet9ja.com/external
|
||||
foreach ($sportmap as $logifuture_sport_id => $sport_id) {
|
||||
|
||||
$data = Auth::exe();
|
||||
|
||||
$header = [];
|
||||
$header[] = 'Authorization: Bearer '.$data['token'];
|
||||
$header[] = 'accept: application/json';
|
||||
$header[] = 'content-type: application/json';
|
||||
|
||||
foreach ($sportmap as $client_sport_id => $sport_id) {
|
||||
$post_fields = [
|
||||
'url' => BaseUrl::get().'/v1/matches?sportId='.$client_sport_id,
|
||||
'header' => json_encode($header),
|
||||
];
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://proxydb1.nuhodds.com/logifuture.php');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
$matches = json_decode($file, 1);
|
||||
$matches = LogifutureData::load($logifuture_sport_id);
|
||||
|
||||
if (! isset($matches['error'])) {
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
return [
|
||||
'app_env' => env('APP_ENV', 'production'),
|
||||
'betsapi_token' => env('BETSAPI_TOKEN', '36152-aeTRNnZxSPUwGe'),
|
||||
'txodds_betaid1' => env('TXODDS_TOKEN_SOCCER', 'ident=betaid1&passwd=Dy59vpRC'),
|
||||
'txodds_betaid2' => env('TXODDS_TOKEN_OTHER', 'ident=betaid1&passwd=Dy59vpRC'),
|
||||
'betsapi_token' => env('BETSAPI_TOKEN', 'ioioioioioio'),
|
||||
'txodds_betaid1' => env('TXODDS_TOKEN_SOCCER', 'ioioioioioio'),
|
||||
'txodds_betaid2' => env('TXODDS_TOKEN_OTHER', 'ioioioioioio'),
|
||||
'logifuture_token' => env('LOGIFUTURE_TOKEN', 'ioioioioioio'),
|
||||
];
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx') {
|
||||
echo 'not authorized';
|
||||
exit;
|
||||
} else {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
|
||||
@@ -17,5 +17,6 @@ if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdm
|
||||
if (curl_errno($ch)) {
|
||||
echo curl_error($ch);
|
||||
}
|
||||
|
||||
echo $file;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx') {
|
||||
echo 'not authorized';
|
||||
exit;
|
||||
} else {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
|
||||
@@ -9,7 +10,7 @@ if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdm
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $_POST['header']);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, json_decode($_POST['header']));
|
||||
|
||||
$file = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
Reference in new issue
Block a user