Advertisement
Guest User

Untitled

a guest
Apr 4th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.37 KB | None | 0 0
  1.  
  2. <center><h4>Сэтгэлийн үндэс нэвтрүүлэгийн хандив өргөсөн хүмүүсийн дансны хуулга </h4></center>
  3. <br/>
  4. <div class="row">
  5. <div class="col-md-10">
  6. <div class="progress">
  7. <div class="progress-bar" role="progressbar" aria-valuenow="123" aria-valuemin="0" aria-valuemax="870000000" style="width: 60%;">
  8. 60%
  9. </div>
  10. </div>
  11. </div>
  12. <div class="col-md-2">
  13. 120-н хүүхдийн цэцэрлэг /870 сая төгрөг/
  14. </div>
  15. </div>
  16. <div class="news_scroller_content">
  17. <table class="table">
  18. <tr>
  19. <th >Дансны дугаар</th>
  20. <th >Мөнгөн дүн</th>
  21. <th >Салбарын дугаар</th>
  22. <th >Журналын дугаар</th>
  23. <th >Гүйлгээ хийсэн огноо</th>
  24. <th >Гүйлгээний утга</th>
  25. <th >Гүйлгээний Төрөл</th>
  26. </tr>
  27.  
  28. <?php
  29. $soapUrl = "https://e.statebank.mn/acntstatement/Statement.asmx"; // asmx URL of WSDL
  30. $soapUser = "MUONRT"; // username
  31. $soapPassword = "bXUvMjAyNzA="; // password
  32.  
  33. // xml post structure
  34. $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
  35. <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  36. <soap:Body>
  37. <AcntStatement xmlns="http://tempuri.org/">
  38. <UserName>MUONRT</UserName>
  39. <Pass>bXUvMjAyNzA=</Pass>
  40. <TxnDate>2016-03-20</TxnDate>
  41. <JrnlNo></JrnlNo>
  42. </AcntStatement>
  43. </soap:Body>
  44. </soap:Envelope>';
  45.  
  46. $headers = array(
  47. "Content-type: text/xml;charset=\"utf-8\"",
  48. "Accept: text/xml",
  49. "Cache-Control: no-cache",
  50. "Pragma: no-cache",
  51. "Content-length: ".strlen($xml_post_string),
  52. ); //SOAPAction: your op URL
  53.  
  54. // PHP cURL for https connection with auth
  55.  
  56. try{
  57. $ch = curl_init();
  58. if (FALSE === $ch)
  59. throw new Exception('failed to initialize');
  60. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  61. curl_setopt($ch, CURLOPT_URL, $soapUrl);
  62. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  63. curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
  64. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  65. curl_setopt($ch, CURLOPT_TIMEOUT, 400);
  66. curl_setopt($ch, CURLOPT_POST, true);
  67. curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
  68. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  69. //curl_setopt($ch, CURLOPT_TIMEOUT, 400);
  70.  
  71. // converting
  72. $response = curl_exec($ch);
  73. if (FALSE === $response)
  74. throw new Exception(curl_error($ch), curl_errno($ch));
  75.  
  76. // var_dump($response);die();
  77. curl_close($ch);
  78.  
  79. }catch(Exception $e) {
  80. trigger_error(sprintf(
  81. 'Curl failed with error #%d: %s',
  82. $e->getCode(), $e->getMessage()), E_USER_ERROR);
  83. }
  84. // converting
  85. $response1 = str_replace("<soap:Body>","",$response);
  86. $response2 = str_replace("</soap:Body>","",$response1);
  87.  
  88. // convertingc to XML
  89. $parser = simplexml_load_string($response2);
  90. $array = json_decode(json_encode((array)$parser), TRUE);
  91.  
  92.  
  93.  
  94. foreach ($array as $acntStatementResponse) {
  95. foreach ($acntStatementResponse as $acntStatementResult) {
  96. $errCode = $acntStatementResult['ErrCode'];
  97. $errDesc = $acntStatementResult['ErrDesc'];
  98. if ($errCode==0){
  99. echo $errDesc;
  100. $allTrans = $acntStatementResult['Trans'];
  101. foreach ($allTrans as $transactions) {
  102. foreach ($transactions as $transaction) { ?>
  103. <tr>
  104. <td ><?php echo $transaction['AcntNo']?></td>
  105. <td ><?php echo $transaction['Amount']?></td>
  106. <td ><?php echo $transaction['Branch']?></td>
  107. <td ><?php echo $transaction['JournalNo']?></td>
  108. <td ><?php echo date("Y-m-d H:i:s",strtotime($transaction['TxnDate']))?></td>
  109. <td ><?php echo $transaction['TxnDesc']?></td>
  110. <td ><?php echo $transaction['TxnType']= 1 ? 'Орлого': 'Зарлага'?></td>
  111. </tr>
  112. <?php
  113. if($transaction['TxnType']==1) {
  114. $money = $money + $transaction['Amount'] ;
  115. } else {
  116. $money = $money - $transaction['Amount'] ;
  117. }
  118. ?>
  119. <?php } ?>
  120. <?php } ?>
  121. <?php } else {?>
  122. <?php echo $errDesc; ?>
  123.  
  124. <?php } ?>
  125. <?php } ?>
  126. <?php } ?>
  127.  
  128. </table>
  129. </div>
  130.  
  131. <?php phpinfo() ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement