mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Add getting plugin data via curl as alt method
Not all servers can get external data using file_get_contents due to security retstrictions
This commit is contained in:
@@ -5,7 +5,13 @@ include("settings.php");
|
||||
$pluginsDataSrc = "http://icecoder.net/plugin-data?format=JSON";
|
||||
|
||||
// Now get our plugin data and put into a PHP array
|
||||
$pluginsDataJS = file_get_contents($pluginsDataSrc, false, $context);
|
||||
if (ini_get('allow_url_fopen')) {
|
||||
$pluginsDataJS = file_get_contents($pluginsDataSrc, false, $context);
|
||||
} elseif (function_exists('curl_init')) {
|
||||
$pDSrc = curl_init($pluginsDataSrc);
|
||||
curl_setopt($pDSrc, CURLOPT_RETURNTRANSFER, true);
|
||||
$pluginsDataJS = curl_exec($pDSrc);
|
||||
}
|
||||
$pluginsData = json_decode($pluginsDataJS, true);
|
||||
|
||||
// If we have an action to perform
|
||||
|
||||
Reference in New Issue
Block a user