logifuture with proxy wip
This commit is contained in:
1 parent
a96abae35a
commit
2e57e49f08
19 files changed
+196
-77
No files matched your search
@@ -16,7 +16,10 @@ class Curl
|
||||
$proxy = Nuh::$options['p'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($url);
|
||||
Notice::note($url, 'g');
|
||||
if ($proxy) {
|
||||
Notice::note(Nuh::$options['proxy'], 'r');
|
||||
}
|
||||
}
|
||||
|
||||
if ($read) {
|
||||
@@ -29,22 +32,10 @@ class Curl
|
||||
|
||||
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) {
|
||||
$ch = curl_init();
|
||||
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_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
@@ -55,34 +46,60 @@ class Curl
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
$ch = curl_init($url);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 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);
|
||||
if ($curl_errorno) {
|
||||
Notice::note('curl_errorno: '.self::curlerrorcode($curl_errorno));
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
$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');
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -15,6 +15,10 @@ class Betsapi
|
||||
{
|
||||
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']) {
|
||||
case 'Fixtures':
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
|
||||
class Odds
|
||||
{
|
||||
/**
|
||||
* 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;
|
||||
|
||||
$res = Odds3way::join('events', 'odds_3ways.event_id', 'events.id')
|
||||
->where('odds_3ways.bookmaker_id', $bookmaker_id)
|
||||
->where('events.starttime', '>', Carbon::now())
|
||||
->where('events.betsapi_id', 0)
|
||||
->where('events.sport_id', $sport_id)
|
||||
->where('odds_3ways.bmoid', '>', 0)->pluck('odds_3ways.event_id', 'odds_3ways.bmoid');
|
||||
$res = Event::with('odds_3way')
|
||||
->where('betsapi_id', 0)
|
||||
->where('sport_id', $sport_id)
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->pluck('id');
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -13,12 +13,9 @@ class Logifuture
|
||||
public static function switch()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$proxy = Nuh::$options['p'] ?? 0;
|
||||
|
||||
$sportmap = Sport::map('logi', 1, [1, 2, 3, 5]);
|
||||
|
||||
dd($sportmap);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['sport']['name'], 'g');
|
||||
}
|
||||
@@ -32,18 +29,42 @@ class Logifuture
|
||||
break;
|
||||
}
|
||||
|
||||
$base_url = BaseUrl::get();
|
||||
|
||||
$header = Auth::exe();
|
||||
$data = Auth::exe();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Grapper\Logifuture\Auth;
|
||||
|
||||
class BaseUrl
|
||||
{
|
||||
@@ -13,17 +14,21 @@ class BaseUrl
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ class Fixtures
|
||||
|
||||
$sportmap = Sport::map('logi', 1, [1, 3]);
|
||||
|
||||
dd($sportmap);
|
||||
|
||||
self::$elements = LoadElements::load(Nuh::$options['provider_id']);
|
||||
|
||||
self::$groups = LoadGroups::load(Nuh::$options['provider_id']);
|
||||
|
||||
@@ -34,7 +34,7 @@ class Fixtures
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('FIXTURES '.Nuh::$options['process'], 'b');
|
||||
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['name'], 'g');
|
||||
}
|
||||
|
||||
$base_url = BaseUrl::get();
|
||||
@@ -43,7 +43,9 @@ class Fixtures
|
||||
* Tornaments
|
||||
*/
|
||||
$url = $base_url.'/sport';
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! is_array($data) or \count($data) == 0) {
|
||||
Notice::note('no data in feed', 'r', 1);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Odds
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('ODDS '.Nuh::$options['process'], 'b');
|
||||
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['name'], 'g');
|
||||
}
|
||||
|
||||
switch (Nuh::$options['provider_id']) {
|
||||
|
||||
@@ -50,8 +50,6 @@ class Fixtures
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
dd($row);
|
||||
|
||||
$event = [
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(),
|
||||
|
||||
@@ -128,10 +128,10 @@ class Odds
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} elseif (Nuh::$options['g']) {
|
||||
// by groups
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->groupBy('group_id')->pluck('group_id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&pgid=".$id;
|
||||
// one week per group names (mybee fastes)
|
||||
$groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id');
|
||||
foreach ($groupids as $groupid) {
|
||||
$_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']) {
|
||||
// one day
|
||||
|
||||
Reference in new issue
Block a user