Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. <?php
  2.  
  3. $postData = file_get_contents('php://input');
  4. //$postData = file_get_contents('1.txt');
  5.  
  6. //file_put_contents("./log/postdata".time().".txt", $postData);
  7.  
  8. $json_postdata=json_decode($postData);
  9.  
  10. $receip_base64=$json_postdata->{'latest_receipt'};
  11. file_put_contents("./log/receip_base64".time().".txt", $receip_base64);
  12.  
  13. $receip = base64_decode($receip_base64);
  14. file_put_contents("./log/receip".time().".txt", $receip);
  15.  
  16. $decoded=$receip;
  17.  
  18.  
  19. preg_match('/purchase-info".+?"(.+?)"/', $decoded, $matches);
  20. $code=base64_decode($matches[1]);
  21.  
  22. file_put_contents("./log/code".time().".txt", $code);
  23.  
  24. $c1=preg_replace('/"(.+?)" = "(.+?)";/','"$1":"$2"',$code);
  25. file_put_contents("./log/c1".time().".txt", $c1);
  26.  
  27. $c1=preg_replace('/,\s+?}/',"}",$c1);
  28. file_put_contents("./log/c2".time().".txt", $c1);
  29.  
  30. $c1=preg_replace('/\n/',",",$c1);
  31. $c1=str_replace('{,',"{",$c1);
  32. $c1=str_replace(',}','}',$c1);
  33.  
  34. file_put_contents("./log/c3".time().".txt", $c1);
  35.  
  36. $j=json_decode($c1);
  37. $jj=$j->{'is-trial-period'};
  38. $oo=$j->{'original-transaction-id'};
  39.  
  40. //Telegram data
  41. $ttoken = "166645134:AAGryfDhh70gN73GfUWbQENEgSTpb4NzeF4"; //API-token бота в Телеграме
  42. $urltelegram = "https://api.telegram.org/bot"; //Адрес на который отправлять
  43. $method = "sendMessage"; //Метод работы
  44. $chat_id = "-1001066735930"; //Айди чата в который будет приходить сообщение
  45.  
  46. $urldone2 = "https://api.telegram.org/bot" . $ttoken . "/" .$method . "?chat_id=" .$chat_id . "&text=IOS STATUS (" . $jj . ") Id: " . $oo . "."; //Генерация полного юрла
  47.  
  48.  
  49. $myCurl = curl_init(); //инициирует curl
  50. curl_setopt_array($myCurl, array(
  51. CURLOPT_URL => $urldone2, //открывает нужны адрес
  52. CURLOPT_RETURNTRANSFER => true, //
  53. CURLOPT_POST => true,
  54. CURLOPT_POSTFIELDS => http_build_query(array(/*здесь массив параметров запроса*/))
  55. ));
  56. $response = curl_exec($myCurl);
  57. curl_close($myCurl);
  58.  
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement