69 lines
2.2 KiB
PHP
69 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
|
|
|
use App\Console\Commands\Grapper\Logifuture;
|
|
use App\Console\Commands\Nuh;
|
|
use App\Utilities\Notice;
|
|
|
|
class LogifutureData
|
|
{
|
|
public static function load($logifuture_sport_id)
|
|
{
|
|
$debug = Nuh::$options['d'] ?? 0;
|
|
|
|
$url = Nuh::$options['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, 'p');
|
|
}
|
|
|
|
$ch = curl_init();
|
|
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,
|
|
'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('DATA direct'.PHP_EOL.$url, 'b');
|
|
}
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $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, Logifuture::$auth_header);
|
|
}
|
|
|
|
$file = curl_exec($ch);
|
|
|
|
if (curl_errno($ch)) {
|
|
echo curl_error($ch);
|
|
}
|
|
|
|
return json_decode($file, true);
|
|
}
|
|
}
|