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 | {
|
---|
11 | private $_xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
|
---|
12 |
|
---|
13 | public function __construct()
|
---|
14 | {
|
---|
15 | parent::__construct();
|
---|
16 | }
|
---|
17 |
|
---|
18 | public function testmo() {
|
---|
19 | $url = 'http://10.58.38.162/violetservice/soanbai/mo?wsdl';
|
---|
20 |
|
---|
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 | //$result = $client->call('MOReceiver', $aryParams ,$operator ,$operation);
|
---|
45 |
|
---|
46 | echo $client->responseData;
|
---|
47 |
|
---|
48 | /* $err = $client->getError();
|
---|
49 |
|
---|
50 | if ($err) {
|
---|
51 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
52 | }
|
---|
53 |
|
---|
54 | echo "<br/>";
|
---|
55 | echo "<h2>Request</h2>";
|
---|
56 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
57 | echo "<h2>Response</h2>";
|
---|
58 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; */
|
---|
59 | }
|
---|
60 |
|
---|
61 | public function send($msg)
|
---|
62 | {
|
---|
63 | $url = $this->config->item('mt_service_url');
|
---|
64 | $username = 'sbg';
|
---|
65 | $password = 'sbg56ab77cdsgb';
|
---|
66 | $operator = 'InsertMT';
|
---|
67 | $operation = 'http://tempuri.org/InsertMT';
|
---|
68 |
|
---|
69 | $aryParams = array(
|
---|
70 | 'User' => $username,
|
---|
71 | 'Pass' => $password,
|
---|
72 | 'CPCode' => '601',
|
---|
73 | 'UserID' => '841662860000',
|
---|
74 | 'RequestID' => '4',
|
---|
75 | 'ReceiverID' => '84988568786',
|
---|
76 | 'ServiceID' => '8062',
|
---|
77 | 'CommandCode' => 'SBG',
|
---|
78 | 'ContentType' => '0',
|
---|
79 | 'Info' => urldecode($msg).' - Host: '.$_SERVER['HTTP_HOST'].' - '. date('Y-m-d H:i:s')//'Test MT '. date('Y-m-d H:i:s'),
|
---|
80 | );
|
---|
81 |
|
---|
82 | $xml = $this->load->view('mt', $aryParams, true);
|
---|
83 | $client = new nusoap_client($url);
|
---|
84 | $client->useHTTPPersistentConnection();
|
---|
85 | $client->soap_defencoding = 'UTF-8';
|
---|
86 | $client->operation = $operation;
|
---|
87 |
|
---|
88 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
89 | $err = $client->getError();
|
---|
90 |
|
---|
91 | if ($err) {
|
---|
92 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
93 | }
|
---|
94 |
|
---|
95 | echo "<br/>";
|
---|
96 | echo "<h2>Request</h2>";
|
---|
97 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
98 | echo "<h2>Response</h2>";
|
---|
99 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
100 |
|
---|
101 | }
|
---|
102 |
|
---|
103 | public function topup ()
|
---|
104 | {
|
---|
105 | $url = $this->config->item('topup_service_url');
|
---|
106 | $operator = 'TopupService';
|
---|
107 | $operation = 'http://soanbaigiang.smas.vn/ITopupService/TopUp';
|
---|
108 |
|
---|
109 | $username = 'sbg';
|
---|
110 | $password = 'sbg56ab77cdsgb';
|
---|
111 |
|
---|
112 | $aryParams = array(
|
---|
113 | 'EWalletID' => 0,
|
---|
114 | 'CardSerial' => '11111',
|
---|
115 | 'PinCard' => 'eeeeeeeee'
|
---|
116 | );
|
---|
117 |
|
---|
118 | $xml = $this->load->view('topup', $aryParams, true);
|
---|
119 | $client = new nusoap_client($url);
|
---|
120 | $client->useHTTPPersistentConnection();
|
---|
121 | $client->soap_defencoding = 'UTF-8';
|
---|
122 | $client->operation = $operation;
|
---|
123 |
|
---|
124 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
125 | $err = $client->getError();
|
---|
126 |
|
---|
127 | if ($client->fault) {
|
---|
128 | echo "<h2>Fault loi:</h2><pre>";
|
---|
129 | print_r($result);
|
---|
130 | echo "</pre>";
|
---|
131 | }
|
---|
132 | else {
|
---|
133 | $error = $client->getError();
|
---|
134 | if ($error) {
|
---|
135 | echo "<h2>Error</h2><pre>" . $error . "</pre>";
|
---|
136 | }
|
---|
137 | else {
|
---|
138 | echo "<h2>Ket Qua</h2><pre>";
|
---|
139 | var_dump($result);
|
---|
140 | echo "</pre>";
|
---|
141 | }
|
---|
142 | }
|
---|
143 | echo "<br/>";
|
---|
144 | echo "<h2>Request</h2>";
|
---|
145 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
146 | echo "<h2>Response</h2>";
|
---|
147 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
148 |
|
---|
149 | }
|
---|
150 |
|
---|
151 | public function charging ()
|
---|
152 | {
|
---|
153 | $url = $this->config->item('charging_service_url');
|
---|
154 |
|
---|
155 | $username = $this->config->item('charging_username');
|
---|
156 | $password = $this->config->item('charging_password');
|
---|
157 |
|
---|
158 | $operator = 'processCharging';
|
---|
159 | $operation = 'http://tempuri.org/processCharging';
|
---|
160 |
|
---|
161 | $aryParams = array(
|
---|
162 | 'user' => $username,
|
---|
163 | 'pass' => $password,
|
---|
164 | 'MSISDN' => '1689925260',
|
---|
165 | 'Charging' => '100',
|
---|
166 | 'Contents' => 'Namta-Active'
|
---|
167 | );
|
---|
168 |
|
---|
169 | $xml = $this->load->view('charging', $aryParams, true);
|
---|
170 | $client = new nusoap_client($url);
|
---|
171 | $client->useHTTPPersistentConnection();
|
---|
172 | $client->soap_defencoding = 'UTF-8';
|
---|
173 | $client->operation = $operation;
|
---|
174 |
|
---|
175 | $result = $client->send($this->_xmlHeader.$xml, $operation);
|
---|
176 | $err = $client->getError();
|
---|
177 |
|
---|
178 | if ($err) {
|
---|
179 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
180 | }
|
---|
181 |
|
---|
182 | echo "<br/>";
|
---|
183 | echo "<h2>Request</h2>";
|
---|
184 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
185 | echo "<h2>Response</h2>";
|
---|
186 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
187 | }
|
---|
188 | } |
---|