[443] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
---|
| 2 | /**
|
---|
| 3 | * Viettel Class
|
---|
| 4 | *
|
---|
| 5 | * @author dzungnv02
|
---|
| 6 | *
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | class Sendmessage extends MX_Controller
|
---|
| 10 | {
|
---|
[457] | 11 | private $_xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
|
---|
| 12 |
|
---|
[443] | 13 | public function __construct()
|
---|
| 14 | {
|
---|
| 15 | parent::__construct();
|
---|
| 16 | }
|
---|
| 17 |
|
---|
[457] | 18 | public function testmo() {
|
---|
| 19 | $url = 'http://10.58.38.162/violetservice/soanbai/mo';
|
---|
| 20 | //$url = 'http://viettel.violet.vn/violetservice/soanbai/mo';
|
---|
| 21 | $aryParams = array(
|
---|
| 22 | 'username' => 'sbg',
|
---|
| 23 | 'password' => 'sbg571285',
|
---|
| 24 | 'requestID' => '4',
|
---|
| 25 | 'userID' => '841662860000',
|
---|
| 26 | 'receiverID' => '84988568786',
|
---|
| 27 | 'serviceID' => '8062',
|
---|
| 28 | 'commandCode' => 'SBG',
|
---|
| 29 | 'contentType' => '0',
|
---|
| 30 | 'info' => 'SBG DK',
|
---|
| 31 | 'receiveTime' => date('Ymd H:i:s')
|
---|
| 32 | );
|
---|
| 33 |
|
---|
| 34 | $client = new nusoap_client($url, false);
|
---|
| 35 | $client->useHTTPPersistentConnection();
|
---|
| 36 | $xml = $this->load->view('mo', null, true);
|
---|
| 37 |
|
---|
| 38 | $operator = 'MOReceiver';
|
---|
| 39 | $operation = 'http://tempuri.org/MOReceiver';
|
---|
| 40 |
|
---|
| 41 | $client->soap_defencoding = 'UTF-8';
|
---|
| 42 | $client->operation = $operation;
|
---|
| 43 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
| 44 |
|
---|
| 45 | //$result = $client->call('MOReceiver', $aryParams ,$operator ,$operation);
|
---|
| 46 |
|
---|
| 47 | $err = $client->getError();
|
---|
| 48 |
|
---|
| 49 | if ($err) {
|
---|
| 50 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | echo "<br/>";
|
---|
| 54 | echo "<h2>Request</h2>";
|
---|
| 55 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
| 56 | echo "<h2>Response</h2>";
|
---|
| 57 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | public function send($msg)
|
---|
[443] | 61 | {
|
---|
| 62 | $url = $this->config->item('mt_service_url');
|
---|
| 63 | $username = 'sbg';
|
---|
| 64 | $password = 'sbg56ab77cdsgb';
|
---|
| 65 | $operator = 'InsertMT';
|
---|
| 66 | $operation = 'http://tempuri.org/InsertMT';
|
---|
[457] | 67 |
|
---|
[443] | 68 | $aryParams = array(
|
---|
| 69 | 'User' => $username,
|
---|
| 70 | 'Pass' => $password,
|
---|
| 71 | 'CPCode' => '601',
|
---|
| 72 | 'UserID' => '841662860000',
|
---|
| 73 | 'RequestID' => '4',
|
---|
| 74 | 'ReceiverID' => '84988568786',
|
---|
| 75 | 'ServiceID' => '8062',
|
---|
| 76 | 'CommandCode' => 'SBG',
|
---|
| 77 | 'ContentType' => '0',
|
---|
[457] | 78 | 'Info' => urldecode($msg).' - Host: '.$_SERVER['HTTP_HOST'].' - '. date('Y-m-d H:i:s')//'Test MT '. date('Y-m-d H:i:s'),
|
---|
[443] | 79 | );
|
---|
| 80 |
|
---|
| 81 | $xml = $this->load->view('mt', $aryParams, true);
|
---|
| 82 | $client = new nusoap_client($url);
|
---|
| 83 | $client->useHTTPPersistentConnection();
|
---|
| 84 | $client->soap_defencoding = 'UTF-8';
|
---|
| 85 | $client->operation = $operation;
|
---|
| 86 |
|
---|
[457] | 87 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
[443] | 88 | $err = $client->getError();
|
---|
| 89 |
|
---|
| 90 | if ($err) {
|
---|
| 91 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | echo "<br/>";
|
---|
| 95 | echo "<h2>Request</h2>";
|
---|
| 96 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
| 97 | echo "<h2>Response</h2>";
|
---|
| 98 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
| 99 |
|
---|
[457] | 100 | }
|
---|
| 101 |
|
---|
| 102 | public function topup ()
|
---|
| 103 | {
|
---|
| 104 | $url = $this->config->item('topup_service_url');
|
---|
| 105 | $operator = 'TopupService';
|
---|
| 106 | $operation = 'http://tempuri.org/ITopupService/TopUp';
|
---|
| 107 |
|
---|
| 108 | $username = 'sbg';
|
---|
| 109 | $password = 'sbg56ab77cdsgb';
|
---|
| 110 |
|
---|
| 111 | $aryParams = array(
|
---|
| 112 | 'EWalletID' => 0,
|
---|
| 113 | 'CardSerial' => '11111',
|
---|
| 114 | 'PinCard' => 'eeeeeeeee'
|
---|
| 115 | );
|
---|
| 116 |
|
---|
| 117 | $xml = $this->load->view('topup', $aryParams, true);
|
---|
| 118 | $client = new nusoap_client($url);
|
---|
| 119 | $client->useHTTPPersistentConnection();
|
---|
| 120 | $client->soap_defencoding = 'UTF-8';
|
---|
| 121 | $client->operation = $operation;
|
---|
| 122 |
|
---|
| 123 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
| 124 | $err = $client->getError();
|
---|
| 125 |
|
---|
| 126 | if ($err) {
|
---|
| 127 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | echo "<br/>";
|
---|
| 131 | echo "<h2>Request</h2>";
|
---|
| 132 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
| 133 | echo "<h2>Response</h2>";
|
---|
| 134 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | public function charging ()
|
---|
| 138 | {
|
---|
| 139 | $url = $this->config->item('charging_service_url');
|
---|
| 140 |
|
---|
| 141 | $username = $this->config->item('charging_username');
|
---|
| 142 | $password = $this->config->item('charging_password');
|
---|
| 143 |
|
---|
| 144 | $operator = 'processCharging';
|
---|
| 145 | $operation = 'http://tempuri.org/processCharging';
|
---|
| 146 |
|
---|
| 147 | $aryParams = array(
|
---|
| 148 | 'user' => $username,
|
---|
| 149 | 'pass' => $password,
|
---|
| 150 | 'MSISDN' => '1689925260',
|
---|
| 151 | 'Charging' => '100',
|
---|
| 152 | 'Contents' => 'Namta-Active'
|
---|
| 153 | );
|
---|
| 154 |
|
---|
| 155 | $xml = $this->load->view('charging', $aryParams, true);
|
---|
| 156 | $client = new nusoap_client($url);
|
---|
| 157 | $client->useHTTPPersistentConnection();
|
---|
| 158 | $client->soap_defencoding = 'UTF-8';
|
---|
| 159 | $client->operation = $operation;
|
---|
| 160 |
|
---|
| 161 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
| 162 | $err = $client->getError();
|
---|
| 163 |
|
---|
| 164 | if ($err) {
|
---|
| 165 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | echo "<br/>";
|
---|
| 169 | echo "<h2>Request</h2>";
|
---|
| 170 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
| 171 | echo "<h2>Response</h2>";
|
---|
| 172 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
| 173 | }
|
---|
[443] | 174 | } |
---|