wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,91 +0,0 @@
|
||||
<?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 $testfiles = '/Console/Commands/TestFiles/';
|
||||
|
||||
public static function load($logifuture_sport_id)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$save = Nuh::$options['s'] ?? 0;
|
||||
$read = Nuh::$options['r'] ?? 0;
|
||||
|
||||
$filename = app_path().self::$testfiles.str_replace(' ', '_', strtolower(Nuh::$options['sport'].'_'.Nuh::$options['provider'])).'.json';
|
||||
|
||||
if ($read) {
|
||||
if ($debug) {
|
||||
Notice::note('data read localy', 'g');
|
||||
}
|
||||
|
||||
$file = file_get_contents($filename);
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
|
||||
$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 ($save) {
|
||||
|
||||
file_put_contents($filename, $file);
|
||||
|
||||
Notice::note('file saved localy', 'g');
|
||||
}
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
echo curl_error($ch);
|
||||
}
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user