using Http::getData instead file_get_contents
This commit is contained in:
parent
c57bbeace3
commit
b5ddf37649
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class Http
|
class Http
|
||||||
{
|
{
|
||||||
public static function getData($url, $headers)
|
public static function getData($url, $headers = [])
|
||||||
{
|
{
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
@ -12,7 +12,7 @@ class Message
|
|||||||
global $config;
|
global $config;
|
||||||
run_hook('send_telegram'); #HOOK
|
run_hook('send_telegram'); #HOOK
|
||||||
if (!empty($config['telegram_bot']) && !empty($config['telegram_target_id'])) {
|
if (!empty($config['telegram_bot']) && !empty($config['telegram_target_id'])) {
|
||||||
file_get_contents('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $config['telegram_target_id'] . '&text=' . urlencode($txt));
|
Http::getData('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $config['telegram_target_id'] . '&text=' . urlencode($txt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class Message
|
|||||||
if (!empty($config['sms_url'])) {
|
if (!empty($config['sms_url'])) {
|
||||||
$smsurl = str_replace('[number]', urlencode($phone), $config['sms_url']);
|
$smsurl = str_replace('[number]', urlencode($phone), $config['sms_url']);
|
||||||
$smsurl = str_replace('[text]', urlencode($txt), $smsurl);
|
$smsurl = str_replace('[text]', urlencode($txt), $smsurl);
|
||||||
file_get_contents($smsurl);
|
Http::getData($smsurl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class Message
|
|||||||
if (!empty($config['wa_url'])) {
|
if (!empty($config['wa_url'])) {
|
||||||
$waurl = str_replace('[number]', urlencode($phone), $config['wa_url']);
|
$waurl = str_replace('[number]', urlencode($phone), $config['wa_url']);
|
||||||
$waurl = str_replace('[text]', urlencode($txt), $waurl);
|
$waurl = str_replace('[text]', urlencode($txt), $waurl);
|
||||||
file_get_contents($waurl);
|
Http::getData($waurl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ $cache = File::pathFixer('system/cache/plugin_repository.json');
|
|||||||
if (file_exists($cache) && time() - filemtime($cache) < (24 * 60 * 60)) {
|
if (file_exists($cache) && time() - filemtime($cache) < (24 * 60 * 60)) {
|
||||||
$json = json_decode(file_get_contents($cache), true);
|
$json = json_decode(file_get_contents($cache), true);
|
||||||
} else {
|
} else {
|
||||||
$data = file_get_contents($plugin_repository);
|
$data = Http::getData($plugin_repository);
|
||||||
file_put_contents($cache, $data);
|
file_put_contents($cache, $data);
|
||||||
$json = json_decode($data, true);
|
$json = json_decode($data, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user