Skip to content

Instantly share code, notes, and snippets.

@krotesk
Created January 17, 2025 12:12
Show Gist options
  • Save krotesk/59f6e30b8ab42f5fbe1ca9ae6f2f76c8 to your computer and use it in GitHub Desktop.
Save krotesk/59f6e30b8ab42f5fbe1ca9ae6f2f76c8 to your computer and use it in GitHub Desktop.
goip_balance.php
#!/usr/bin/php -q
<?php
$today = date("Ymd");
file_get_contents('http://admin:[email protected]/default/en_US/ussd_info.html', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded",
'content' => http_build_query([
'line1' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*105#', 'send' => 'Send',
'line2' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*100#', 'send' => 'Send',
'line3' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*100#', 'send' => 'Send',
'line4' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*100#', 'send' => 'Send',
'line5' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*100#', 'send' => 'Send',
'line6' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*110*45#', 'send' => 'Send',
'line7' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*100#', 'send' => 'Send',
'line8' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '*102#', 'send' => 'Send',
])
]
]));
sleep(30);
$url8 = 'http://192.168.10.210/default/en_US/send_status.xml?u=admin&p=password';
$file_name = '/usr/local/bin/balance8.xml';
file_put_contents($file_name,file_get_contents($url8));
file_get_contents('http://admin:[email protected]/default/en_US/ussd_info.html', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded",
'content' => http_build_query([
'line1' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line2' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line3' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line4' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line5' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line6' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line7' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
'line8' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100*1#', 'send' => 'Send',
])
]
]));
sleep(30);
$url8 = 'http://192.168.10.210/default/en_US/send_status.xml?u=admin&p=password';
$file_name = '/usr/local/bin/minutes8.xml';
file_put_contents($file_name,file_get_contents($url8));
file_get_contents('http://admin:[email protected]/default/en_US/ussd_info.html', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded",
'content' => http_build_query([
'line1' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#105#', 'send' => 'Send',
'line2' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100#', 'send' => 'Send',
'line3' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100#', 'send' => 'Send',
'line4' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100#', 'send' => 'Send',
'line5' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100#', 'send' => 'Send',
'line6' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#102#', 'send' => 'Send',
'line7' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#100#', 'send' => 'Send',
'line8' => '1', 'smskey' => $today, 'action' => 'USSD', 'telnum' => '#102#', 'send' => 'Send',
])
]
]));
//chat id
$chatID='';
$xmlb=simplexml_load_file("/usr/local/bin/balance8.xml") or die("Error: Cannot create object");
$xmlm=simplexml_load_file("/usr/local/bin/minutes8.xml") or die("Error: Cannot create object");
$xmln=simplexml_load_file("/usr/local/bin/numbers.xml") or die("Error: Cannot create object");
//token bot
$website = "";
$i=1;
//Infopath
$infobm='PBX';
do {
$ch="ch8_".$i;
$val=$xmln->$ch;
if (!is_null($val))
{
$error="error".$i;
if ($xmlb->$error != "GSM_LOGOUT") {
$pieces = explode(":",$xmlb->$error);
$pieces = explode("r",$pieces[1]);
$min = explode("acts",$xmlm->$error);
$min = explode(" ",$min[0]);
$min = explode("min",$min[1]);
if ($pieces[0] < 100 or $min[0] <100) {
$infobm = $infobm . "<b><i>" . $val . " - " . $xmlb->$error . ". " . $xmlm->$error . "</i></b>\r\n";
}
else {
$infobm = $infobm . $val . " - " . $xmlb->$error . ". " . $xmlm->$error . "\r\n";
}
}
}
$i++;
} while ($i < 9);
$params=[
'chat_id'=>$chatID,
'text'=>$infobm,
'parse_mode'=>'html',
];
$ch = curl_init($website . '/sendMessage');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
$i=1;
$infobm='';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment