Changeset 457 for pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
- Timestamp:
- Nov 10, 2014 11:56:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
r443 r457 9 9 class Sendmessage extends MX_Controller 10 10 { 11 11 private $_xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; 12 12 13 public function __construct() 13 14 { … … 15 16 } 16 17 17 public function send() 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) 18 61 { 19 62 $url = $this->config->item('mt_service_url'); … … 22 65 $operator = 'InsertMT'; 23 66 $operation = 'http://tempuri.org/InsertMT'; 24 $xmlHeader = '<?xml version="1.0" encoding="utf-8" ?>'."\n"; 25 67 26 68 $aryParams = array( 27 69 'User' => $username, … … 34 76 'CommandCode' => 'SBG', 35 77 'ContentType' => '0', 36 'Info' => 'SMS test!- Host: '.$_SERVER['HTTP_HOST'].' - '. date('Y-m-d H:i:s')//'Test MT '. date('Y-m-d H:i:s'),78 'Info' => urldecode($msg).' - Host: '.$_SERVER['HTTP_HOST'].' - '. date('Y-m-d H:i:s')//'Test MT '. date('Y-m-d H:i:s'), 37 79 ); 38 80 … … 43 85 $client->operation = $operation; 44 86 45 $result = $client->send($ xmlHeader.$xml, $operation);87 $result = $client->send($this->_xmlHeader.$xml, $operation); 46 88 $err = $client->getError(); 47 89 … … 56 98 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 57 99 58 } 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 } 59 174 }
Note: See TracChangeset
for help on using the changeset viewer.