logifuture with proxy wip

This commit is contained in:
salam committed 2026-01-05 16:23:14 +01:00
1 parent a96abae35a
commit 2e57e49f08
19 files changed
+196 -77

No files matched your search

+39 -22
View File
@@ -16,7 +16,10 @@ class Curl
$proxy = Nuh::$options['p'] ?? 0; $proxy = Nuh::$options['p'] ?? 0;
if ($debug) { if ($debug) {
Notice::note($url); Notice::note($url, 'g');
if ($proxy) {
Notice::note(Nuh::$options['proxy'], 'r');
}
} }
if ($read) { if ($read) {
@@ -29,22 +32,10 @@ class Curl
return json_decode($file, true); return json_decode($file, true);
} }
// POST
if (isset($_config['post'])) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($_config['post']));
}
// JSON
if (isset($_config['header'])) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $_config['header']);
}
if ($proxy) { if ($proxy) {
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, Nuh::$options['proxy']); curl_setopt($ch, CURLOPT_URL, Nuh::$options['proxy']);
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
@@ -55,34 +46,60 @@ class Curl
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx', 'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
]); ]);
} else { } else {
$ch = curl_init($url); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FAILONERROR, true);
// POST
if (isset($_config['post'])) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($_config['post']));
}
// JSON
if (isset($_config['header'])) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $_config['header']);
}
} }
$data = curl_exec($ch); $file = curl_exec($ch);
$curl_errorno = curl_errno($ch); $curl_errorno = curl_errno($ch);
if ($curl_errorno) { if ($curl_errorno) {
Notice::note('curl_errorno: '.self::curlerrorcode($curl_errorno)); Notice::note('curl_errorno: '.self::curlerrorcode($curl_errorno));
} }
if (PHP_VERSION_ID < 80000) {
curl_close($ch);
}
if ($save) { if ($save) {
$filename = app_path().self::$testfiles.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json'; $filename = app_path().self::$testfiles.strtolower(str_replace(' ', '_', Nuh::$options['name'])).'.json';
file_put_contents($filename, $data); file_put_contents($filename, $file);
Notice::note('file saved localy', 'g'); Notice::note('file saved localy', 'g');
} }
return json_decode($data, true); $data = json_decode($file, true);
switch (json_last_error()) {
case JSON_ERROR_DEPTH:
echo ' - Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
echo ' - Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
echo ' - Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
echo ' - Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
break;
}
return $data;
} }
public static function curlerrorcode($id) public static function curlerrorcode($id)
+4
View File
@@ -15,6 +15,10 @@ class Betsapi
{ {
public static function switch() public static function switch()
{ {
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['name'], 'b');
}
switch (Nuh::$options['name']) { switch (Nuh::$options['name']) {
case 'Fixtures': case 'Fixtures':
@@ -2,13 +2,15 @@
namespace App\Console\Commands\Grapper\Betsapi; namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Nuh;
class Odds class Odds
{ {
/** /**
* Create a new class instance. * Create a new class instance.
*/ */
public function __construct() public static function grap()
{ {
// $debug = Nuh::$options['d'] ?? 0;
} }
} }
@@ -31,14 +31,18 @@ class Willhill
*/ */
$bookmaker_id = 42; $bookmaker_id = 42;
$res = Odds3way::join('events', 'odds_3ways.event_id', 'events.id') $res = Event::with('odds_3way')
->where('odds_3ways.bookmaker_id', $bookmaker_id) ->where('betsapi_id', 0)
->where('events.starttime', '>', Carbon::now()) ->where('sport_id', $sport_id)
->where('events.betsapi_id', 0) ->where('starttime', '>', Carbon::now())
->where('events.sport_id', $sport_id) ->pluck('id');
->where('odds_3ways.bmoid', '>', 0)->pluck('odds_3ways.event_id', 'odds_3ways.bmoid');
foreach ($res as $willhill_id => $txodds_id) { $events = Odds3way::where('bookmaker_id', $bookmaker_id)
->whereIn('event_id', $res)
->where('bmoid', '!=', 0)
->pluck('event_id', 'bmoid');
foreach ($events as $willhill_id => $txodds_id) {
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$willhill_id; $url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$willhill_id;
+30 -9
View File
@@ -13,12 +13,9 @@ class Logifuture
public static function switch() public static function switch()
{ {
$debug = Nuh::$options['d'] ?? 0; $debug = Nuh::$options['d'] ?? 0;
$proxy = Nuh::$options['p'] ?? 0;
$sportmap = Sport::map('logi', 1, [1, 2, 3, 5]); $sportmap = Sport::map('logi', 1, [1, 2, 3, 5]);
dd($sportmap);
if ($debug) { if ($debug) {
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['sport']['name'], 'g'); Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['sport']['name'], 'g');
} }
@@ -32,18 +29,42 @@ class Logifuture
break; break;
} }
$base_url = BaseUrl::get(); $data = Auth::exe();
$header = Auth::exe();
foreach ($sportmap as $client_sportid => $sportid) { foreach ($sportmap as $client_sportid => $sportid) {
$url = $base_url.'/v1/matches?sportId='.$client_sportid; $post_fields = [
'url' => BaseUrl::get().'/v1/matches?sportId='.$client_sportid,
'header' => json_encode(['Authorization: Bearer '.$data['token'], 'accept: application/json', 'content-type: application/json']),
];
$data = Loader::curlLoader($url, ['curl_options' => $header]); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://proxydb1.nuhodds.com/logifuture.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
]);
$file = curl_exec($ch);
dd($file);
$data = json_decode($file, true);
dd($data); dd($data);
} }
} }
} }
$header = [];
$header[] = 'Authorization: Bearer '.$data['token'];
$header[] = 'accept: application/json';
$header[] = 'content-type: application/json';
return $header;
@@ -4,38 +4,33 @@ namespace App\Console\Commands\Grapper\Logifuture;
class Auth class Auth
{ {
public static $pass = 'nuhodds'; public static $password;
public static function exe() public static function exe()
{ {
$base_url = BaseUrl::get();
$base_url = BaseUrl::get();
$url = $base_url.'/v1/authentication/token'; $url = $base_url.'/v1/authentication/token';
$data = Loader::curlLoader($url, [ $ch = curl_init();
'header' => [ curl_setopt($ch, CURLOPT_URL, 'https://proxydb1.nuhodds.com/proxy.php');
'accept: application/json', curl_setopt($ch, CURLOPT_TIMEOUT, 30);
'content-type: application/json', curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
], curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
'post' => [ curl_setopt($ch, CURLOPT_POST, true);
'username' => 'nuhodds', curl_setopt($ch, CURLOPT_POSTFIELDS, [
'password' => self::$pass, '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'); $data = json_decode($file, true);
sleep(60);
return false; return $data;
}
$header = $data;
$header[] = 'Authorization: Bearer '.$data['token'];
$header[] = 'accept: application/json';
$header[] = 'content-type: application/json';
return $header;
} }
} }
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Logifuture; namespace App\Console\Commands\Grapper\Logifuture;
use App\Console\Commands\Nuh; use App\Console\Commands\Nuh;
use App\Console\Commands\Grapper\Logifuture\Auth;
class BaseUrl class BaseUrl
{ {
@@ -13,17 +14,21 @@ class BaseUrl
switch (Nuh::$options['provider_id']) { switch (Nuh::$options['provider_id']) {
case 5: case 5:
if ($test) { if ($test) {
Auth::$password = 'nuhodds';
$base_url = 'https://stg-external-api.bet9ja.com/external'; $base_url = 'https://stg-external-api.bet9ja.com/external';
} else { } else {
Auth::$password = 'uSwIqs!Y3eHrNbyH';
$base_url = 'https://external-api.bet9ja.com/external'; $base_url = 'https://external-api.bet9ja.com/external';
} }
break; break;
case 6: case 6:
if ($test) { if ($test) {
Auth::$password = 'nuhodds';
$base_url = 'https://stg-external-api.yajuego.co/external'; $base_url = 'https://stg-external-api.yajuego.co/external';
} else { } else {
$base_url = 'https://external-api.yajuego.co/external'; $base_url = 'https://external-api.yajuego.co/external';
Auth::$password = 'uSwIqs!Y3eHrNbyH';
} }
break; break;
} }
@@ -25,8 +25,6 @@ class Fixtures
$sportmap = Sport::map('logi', 1, [1, 3]); $sportmap = Sport::map('logi', 1, [1, 3]);
dd($sportmap);
self::$elements = LoadElements::load(Nuh::$options['provider_id']); self::$elements = LoadElements::load(Nuh::$options['provider_id']);
self::$groups = LoadGroups::load(Nuh::$options['provider_id']); self::$groups = LoadGroups::load(Nuh::$options['provider_id']);
@@ -34,7 +34,7 @@ class Fixtures
} }
if ($debug) { if ($debug) {
Notice::note('FIXTURES '.Nuh::$options['process'], 'b'); Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['name'], 'g');
} }
$base_url = BaseUrl::get(); $base_url = BaseUrl::get();
@@ -43,7 +43,9 @@ class Fixtures
* Tornaments * Tornaments
*/ */
$url = $base_url.'/sport'; $url = $base_url.'/sport';
$data = Curl::load($url); $data = Curl::load($url);
if (! is_array($data) or \count($data) == 0) { if (! is_array($data) or \count($data) == 0) {
Notice::note('no data in feed', 'r', 1); Notice::note('no data in feed', 'r', 1);
+1 -1
View File
@@ -37,7 +37,7 @@ class Odds
} }
if ($debug) { if ($debug) {
Notice::note('ODDS '.Nuh::$options['process'], 'b'); Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['name'], 'g');
} }
switch (Nuh::$options['provider_id']) { switch (Nuh::$options['provider_id']) {
@@ -50,8 +50,6 @@ class Fixtures
foreach ($data as $row) { foreach ($data as $row) {
dd($row);
$event = [ $event = [
'provider_id' => (int) Nuh::$options['provider_id'], 'provider_id' => (int) Nuh::$options['provider_id'],
'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(), 'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(),
+4 -4
View File
@@ -128,10 +128,10 @@ class Odds
$_calls[] = $url."&ot=$markets&peid=".$id; $_calls[] = $url."&ot=$markets&peid=".$id;
} }
} elseif (Nuh::$options['g']) { } elseif (Nuh::$options['g']) {
// by groups // one week per group names (mybee fastes)
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->groupBy('group_id')->pluck('group_id'); $groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id');
foreach ($res as $id) { foreach ($groupids as $groupid) {
$_calls[] = $url."&ot=$markets&pgid=".$id; $_calls[] = $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&ot='.$markets.'&days=0,7&pgid='.$groupid;
} }
} elseif (Nuh::$options['b']) { } elseif (Nuh::$options['b']) {
// one day // one day
+1 -1
View File
@@ -28,7 +28,7 @@
"fakerphp/faker": "^1.23", "fakerphp/faker": "^1.23",
"filament/upgrade": "^4.0", "filament/upgrade": "^4.0",
"laravel/pail": "^1.2.2", "laravel/pail": "^1.2.2",
"laravel/pint": "^1.13", "laravel/pint": "^1.26",
"laravel/sail": "^1.41", "laravel/sail": "^1.41",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6", "nunomaduro/collision": "^8.6",
Generated
+1 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "79916f11ba10822650ae1a1dc62bbfe3", "content-hash": "5d42c638156872c2ef5cc1aaf5a1cb3b",
"packages": [ "packages": [
{ {
"name": "agencetwogether/hookshelper", "name": "agencetwogether/hookshelper",
+2 -2
View File
@@ -18,8 +18,8 @@ class ProvoiderSeeder extends Seeder
('2', 'BETSAPI'), ('2', 'BETSAPI'),
('3', 'MAGLOO KENIA'), ('3', 'MAGLOO KENIA'),
('4', 'MAGLOO NIGERIA'), ('4', 'MAGLOO NIGERIA'),
('5', 'LOGIFUTUR NIGERA'), ('5', 'LOGIFUTURE NIGERA'),
('6', 'LOGIFUTUR COLOMBIA'); ('6', 'LOGIFUTURE COLOMBIA');
"; ";
DB::unprepared($sql); DB::unprepared($sql);
+13
View File
@@ -42,6 +42,18 @@ case "$1" in
php artisan config:clear php artisan config:clear
php artisan view:clear php artisan view:clear
;; ;;
"9")
a nuh --d --b 1
a nuh --d --g 2
a nuh --d --b 3
a nuh --d 4
a nuh --d 5
a nuh --d --b 6
a nuh --d --p 8
a nuh --d --p 9
a nuh --d --p 10
a nuh --d --p 11
;;
*) *)
echo "" echo ""
echo "--------------------------" echo "--------------------------"
@@ -55,6 +67,7 @@ case "$1" in
echo "6 => a filament:assets (copy to prod)" echo "6 => a filament:assets (copy to prod)"
echo "7 => a db:seed --force" echo "7 => a db:seed --force"
echo "8 => a cache:clear view:clear" echo "8 => a cache:clear view:clear"
echo "9 => grap all books all sports for 1 day"
echo "--------------------------" echo "--------------------------"
echo "" echo ""
;; ;;
+19
View File
@@ -0,0 +1,19 @@
<?php
if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx') {
echo 'not authorized';
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
curl_setopt($ch, CURLOPT_HEADER, false);
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']);
$file = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
}
echo $file;
}
+20
View File
@@ -0,0 +1,20 @@
<?php
if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx') {
echo 'not authorized';
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$file = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
}
echo $file;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
if ($_SERVER['HTTP_PROXY_AUTH'] != 'AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx') {
echo 'not authorized';
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
curl_setopt($ch, CURLOPT_HEADER, false);
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' => $_POST['password']]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['accept: application/json', 'content-type: application/json']);
$file = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
}
echo $file;
}