wip
This commit is contained in:
1 parent
d16a8a3a1f
commit
ba6c2263e3
11 files changed
+230
-50
No files matched your search
@@ -8,11 +8,12 @@ class Curl
|
||||
{
|
||||
public static $file;
|
||||
|
||||
public static function load($url, $proxy = false)
|
||||
public static function load($url)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$save = Nuh::$options['s'] ?? 0;
|
||||
$read = Nuh::$options['r'] ?? 0;
|
||||
$proxy = Nuh::$options['p'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($url);
|
||||
@@ -30,32 +31,36 @@ class Curl
|
||||
}
|
||||
|
||||
if ($proxy) {
|
||||
$request = curl_init('https://proxydb1.nuhodds.com');
|
||||
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($request, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($request, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: iKduDrM9HJA6T6t5e5xnkQ9KUNWLvTXhRwdUEN2Twfwlr4jzu',
|
||||
'Proxy-Target-URL: '.$url,
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, Nuh::$options['proxy']);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
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, ['url' => $url]);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
|
||||
return curl_exec($request);
|
||||
} else {
|
||||
$request = curl_init($url);
|
||||
curl_setopt($request, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($request, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($request, CURLOPT_FAILONERROR, true);
|
||||
$ch = curl_init($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);
|
||||
}
|
||||
|
||||
$data = curl_exec($request);
|
||||
$data = curl_exec($ch);
|
||||
|
||||
$curl_errorno = curl_errno($request);
|
||||
$curl_errorno = curl_errno($ch);
|
||||
if ($curl_errorno) {
|
||||
Notice::note('curl_errorno: '.self::curlerrorcode($curl_errorno));
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
curl_close($request);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
|
||||
Reference in new issue
Block a user