Current File : //root/panel/etc/apps/softaculous/ImportingSoftaculous.php |
<?php
$url = 'http://45.113.136.119/index.php?'.
'api_key=fhJHtGxt3FkQ5G6S'.
'&api_pass=mVCByzzrLN71S5iFo3U6M4oeutqUc77b'.
'&act=home'.
'&api=serialize';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// Get response from the server.
$resp = curl_exec($ch);
// Unserialize data
$res = unserialize($resp);
$file = '/etc/sentora/panel/etc/apps/softaculous/scripts.txt';
$hr_soft_break = ":HR_SOFT_BR:";
if($res) {
if(file_exists($file))
unlink ($file);
foreach ($res as $all_res_key => $all_res_val) {
if($all_res_key == "iscripts") {
foreach ($all_res_val as $script_key => $script_val) {
$cat = "";
$cats = [];
foreach ($script_val as $cat_key => $cat_val) {
$cats[] = $cat_key.":HR_SOFT_KEY_VALUE:".$cat_val;
//$file = "/etc/sentora/panel/etc/apps/softaculous/scripts.txt";
//$cat .= $cat_val.$hr_soft_break;
/*($script_key == "softname") {
$ = $script_val;
}
//$sss = file_put_contents($file, $cat, FILE_APPEND | LOCK_EX);
//echo fwrite($file,"$cat_val\t");
/*if($cat_key == "type") {
$type[] = $cat_val;
}
if($cat_key == "cat") {
$category[] = $cat_val;
}
/*if($script_key == "name") {
$category['name'][] = $script_val;
}*/
}
//print_r($cats);exit;
//echo $cat;exit;
$cat = implode($hr_soft_break, $cats);
$eol = PHP_EOL;
$cat = $cat.$eol;
file_put_contents($file, $cat, FILE_APPEND | LOCK_EX);
}
}
}
}
fclose($file);
print_r(json_encode($cats));exit;
//$category = array_unique($category);
//print_r(json_encode($category));
exit;
?>