MINI Sh3ll
Path : /var/www/html/crons/ |
|
Current File : /var/www/html/crons/upload-data-to-treepye.php |
<?php
$operators = ['airtel', 'vodafone', 'vodafone-idea', 'reliance-jio', 'reliance-jio-bin'];
$operator = count($argv) > 1 ? $argv[1] : '';
if(!in_array($operator, $operators)){
print 'Error : Mentioned operator is not valid.'.PHP_EOL;
die;
}
function make_get_request($url)
{
$response = '';
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false, // Disabled SSL Cert checks
CURLOPT_SSL_VERIFYHOST => 0
);
$ch = curl_init( trim($url) );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );
$response = $header['http_code'] == '200' ? $content : 'HTTP Error : '.$header['http_code'];
return $response;
}
$logPath = '/var/www/html/api.smartwireless.in/tollfree-sms/logger/november-2021/';
$treepye_url = 'http://192.168.10.24/ingest/save-tollfree-record.php?data=';
$file = fopen($logPath.'responses-15112021.log','r');
while (!feof($file)){
$line = fgets($file);
$obj = json_decode($line, true);
if($obj['operator'] == $operator) {
$turl = $treepye_url.urlencode($line);
$response = make_get_request($turl);
print $response.PHP_EOL;
//die;
}
}
?>
OHA YOOOO