Changeset 909 for pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
- Timestamp:
- Apr 24, 2015 11:17:57 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
r884 r909 2 2 /** 3 3 * Viettel Class 4 * 4 * 5 5 * @author dzungnv02 6 6 * 7 7 */ 8 8 9 class Sendmessage extends MX_Controller 9 class Sendmessage extends MX_Controller 10 10 { 11 11 private $_xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; 12 13 public function __construct() 12 13 public function __construct() 14 14 { 15 15 parent::__construct(); 16 16 } 17 18 public function index () 17 18 public function index () 19 19 { 20 20 error_reporting(E_ALL); … … 29 29 echo $this->Services_model->cardPaidProcess($aryParams); 30 30 } 31 31 32 32 public function testmo() { 33 33 $url = 'http://10.58.38.162/violetservice/soanbai/mo?wsdl'; … … 45 45 'receiveTime' => date('Ymd H:i:s') 46 46 ); 47 47 48 48 $client = new nusoap_client($url, false); 49 49 $client->useHTTPPersistentConnection(); 50 50 $xml = $this->load->view('mo', null, true); 51 51 52 52 $operator = 'MOReceiver'; 53 53 $operation = 'http://tempuri.org/MOReceiver'; … … 55 55 $client->soap_defencoding = 'UTF-8'; 56 56 $client->operation = $operation; 57 $result = $client->send($this->_xmlHeader.$xml, $operation); 57 $result = $client->send($this->_xmlHeader.$xml, $operation); 58 58 //$result = $client->call('MOReceiver', $aryParams ,$operator ,$operation); 59 59 60 60 echo $client->responseData; 61 61 62 62 /* $err = $client->getError(); 63 63 64 64 if ($err) { 65 65 echo '<p><b>Error: ' . $err . '</b></p>'; 66 66 } 67 68 echo "<br/>"; 69 echo "<h2>Request</h2>"; 70 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 71 echo "<h2>Response</h2>"; 72 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; */ 73 } 74 67 68 echo "<br/>"; 69 echo "<h2>Request</h2>"; 70 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 71 echo "<h2>Response</h2>"; 72 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; */ 73 } 74 75 75 public function send($msg, $receiverID) 76 76 { … … 80 80 $operator = 'InsertMT'; 81 81 $operation = 'http://tempuri.org/InsertMT'; 82 82 83 83 $aryMatch = array(); 84 84 if (preg_match('/^(0)([0-9]{9,10})$/', $receiverID, $aryMatch) == 1) { 85 85 $receiverID = '84'. $aryMatch[2]; 86 86 } 87 87 88 88 $aryParams = array( 89 89 'User' => $username, … … 98 98 'Info' => urldecode($msg).' - Host: '.$_SERVER['HTTP_HOST'].' - '. date('Y-m-d H:i:s')//'Test MT '. date('Y-m-d H:i:s'), 99 99 ); 100 100 101 101 $xml = $this->load->view('mt', $aryParams, true); 102 102 $client = new nusoap_client($url); … … 104 104 $client->soap_defencoding = 'UTF-8'; 105 105 $client->operation = $operation; 106 106 107 107 $result = $client->send($this->_xmlHeader.$xml, $operation); 108 108 $err = $client->getError(); 109 109 110 110 if ($err) { 111 111 echo '<p><b>Error: ' . $err . '</b></p>'; 112 112 } 113 113 114 114 var_dump($result); 115 115 116 116 echo "<br/>"; 117 117 echo "<h2>Request</h2>"; … … 119 119 echo "<h2>Response</h2>"; 120 120 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 121 122 } 123 124 public function topup () 121 122 } 123 124 public function topup () 125 125 { 126 126 $url = $this->config->item('topup_service_url'); 127 127 128 128 //echo file_get_contents($url); 129 129 //exit(); 130 130 131 131 $operation = 'http://tempuri.org/ITopupService/TopUp'; 132 132 133 133 $username = 'sbg'; 134 134 $password = 'sbg56ab77cdsgb'; 135 135 136 136 $aryParams = array( 137 137 'EWalletID' => 0, … … 144 144 $client->soap_defencoding = 'UTF-8'; 145 145 $client->operation = $operation; 146 146 147 147 $result = $client->send($this->_xmlHeader.$xml, $operation); 148 148 $err = $client->getError(); 149 149 150 150 if ($client->fault) { 151 151 echo "<h2>Fault loi:</h2><pre>"; … … 169 169 echo "<h2>Response</h2>"; 170 170 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 171 172 } 173 174 public function charging () 175 { 171 172 } 173 174 public function chargingws () 175 { 176 //$op = $this->input->get('op', TRUE); 177 //$op = trim($op) == '' ? 'Balance' : 'processCharging'; 176 178 $url = $this->config->item('charging_service_url'); 177 179 $content = file_get_contents ($url.'?op=Charge'); 180 header('Content-Type: text/html; charset=utf-8'); 181 echo $content; 182 } 183 184 public function getBalance() 185 { 186 //GetAmountBalance 187 $url = $this->config->item('charging_service_url'); 188 178 189 $username = $this->config->item('charging_username'); 179 190 $password = $this->config->item('charging_password'); 180 191 $operator = 'GetAmountBalance'; 192 $operation = 'http://tempuri.org/Balance'; 193 194 $aryParams = array( 195 'user' => $username, 196 'pass' => $password, 197 'MSISDN' => '01662860000', 198 ); 199 200 $xml = $this->load->view('chargingBalance', $aryParams, true); 201 $client = new nusoap_client($url.'?op=Balance'); 202 $client->useHTTPPersistentConnection(); 203 $client->soap_defencoding = 'UTF-8'; 204 $client->operation = $operation; 205 206 $result = $client->send($this->_xmlHeader.$xml, $operation); 207 $err = $client->getError(); 208 209 if ($err) { 210 echo '<p><b>Error: ' . $err . '</b></p>'; 211 } 212 213 var_dump($result); 214 215 echo "<br/>"; 216 echo "<h2>Request</h2>"; 217 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 218 echo "<h2>Response</h2>"; 219 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 220 } 221 222 public function charging () 223 { 224 $url = $this->config->item('charging_service_url'); 225 226 $username = $this->config->item('charging_username'); 227 $password = $this->config->item('charging_password'); 228 181 229 $operator = 'processCharging'; 182 $operation = 'http://tempuri.org/ processCharging';183 230 $operation = 'http://tempuri.org/Charge'; 231 184 232 $aryParams = array( 185 233 'user' => $username, … … 189 237 'Contents' => 'Namta-Active' 190 238 ); 191 239 192 240 $xml = $this->load->view('charging', $aryParams, true); 193 241 $client = new nusoap_client($url); … … 195 243 $client->soap_defencoding = 'UTF-8'; 196 244 $client->operation = $operation; 197 245 198 246 $result = $client->send($this->_xmlHeader.$xml, $operation); 199 247 $err = $client->getError(); 200 248 201 249 if ($err) { 202 250 echo '<p><b>Error: ' . $err . '</b></p>'; 203 251 } 204 252 205 253 var_dump($result); 206 207 echo "<br/>"; 208 echo "<h2>Request</h2>"; 209 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 210 echo "<h2>Response</h2>"; 211 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 212 } 213 254 255 echo "<br/>"; 256 echo "<h2>Request</h2>"; 257 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 258 echo "<h2>Response</h2>"; 259 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 260 } 261 214 262 public function getCollaborators () { 215 263 $client = new SoapClient($this->config->item('bccs_service_url'), array( 'trace' => true, … … 219 267 $password = $this->config->item('bccs_password'); 220 268 $wscode = 'getListShopAndStaftInfo'; 221 269 222 270 $input = new Input($username, $password, $wscode/* , 2, 1,5000 */); 223 271 $param = new Param(); 224 272 225 273 $params = array( 226 274 "Input" => $input, … … 228 276 "Param" => $param, 229 277 ); 230 278 231 279 var_dump($params); 232 280 … … 234 282 var_dump($response); 235 283 } 236 237 284 285 238 286 } 239 287
Note: See TracChangeset
for help on using the changeset viewer.