Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $postData = file_get_contents('php://input');
- //$postData = file_get_contents('1.txt');
- //file_put_contents("./log/postdata".time().".txt", $postData);
- $json_postdata=json_decode($postData);
- $receip_base64=$json_postdata->{'latest_receipt'};
- file_put_contents("./log/receip_base64".time().".txt", $receip_base64);
- $receip = base64_decode($receip_base64);
- file_put_contents("./log/receip".time().".txt", $receip);
- $decoded=$receip;
- preg_match('/purchase-info".+?"(.+?)"/', $decoded, $matches);
- $code=base64_decode($matches[1]);
- file_put_contents("./log/code".time().".txt", $code);
- $c1=preg_replace('/"(.+?)" = "(.+?)";/','"$1":"$2"',$code);
- file_put_contents("./log/c1".time().".txt", $c1);
- $c1=preg_replace('/,\s+?}/',"}",$c1);
- file_put_contents("./log/c2".time().".txt", $c1);
- $c1=preg_replace('/\n/',",",$c1);
- $c1=str_replace('{,',"{",$c1);
- $c1=str_replace(',}','}',$c1);
- file_put_contents("./log/c3".time().".txt", $c1);
- $j=json_decode($c1);
- $jj=$j->{'is-trial-period'};
- $oo=$j->{'original-transaction-id'};
- //Telegram data
- $ttoken = "166645134:AAGryfDhh70gN73GfUWbQENEgSTpb4NzeF4"; //API-token бота в Телеграме
- $urltelegram = "https://api.telegram.org/bot"; //Адрес на который отправлять
- $method = "sendMessage"; //Метод работы
- $chat_id = "-1001066735930"; //Айди чата в который будет приходить сообщение
- $urldone2 = "https://api.telegram.org/bot" . $ttoken . "/" .$method . "?chat_id=" .$chat_id . "&text=IOS STATUS (" . $jj . ") Id: " . $oo . "."; //Генерация полного юрла
- $myCurl = curl_init(); //инициирует curl
- curl_setopt_array($myCurl, array(
- CURLOPT_URL => $urldone2, //открывает нужны адрес
- CURLOPT_RETURNTRANSFER => true, //
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => http_build_query(array(/*здесь массив параметров запроса*/))
- ));
- $response = curl_exec($myCurl);
- curl_close($myCurl);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement