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 |
|
---|
12 | public function __construct()
|
---|
13 | {
|
---|
14 | parent::__construct();
|
---|
15 | }
|
---|
16 |
|
---|
17 | public function send()
|
---|
18 | {
|
---|
19 | $url = $this->config->item('mt_service_url');
|
---|
20 | $username = 'sbg';
|
---|
21 | $password = 'sbg56ab77cdsgb';
|
---|
22 | $operator = 'InsertMT';
|
---|
23 | $operation = 'http://tempuri.org/InsertMT';
|
---|
24 | $xmlHeader = '<?xml version="1.0" encoding="utf-8" ?>'."\n";
|
---|
25 |
|
---|
26 | $aryParams = array(
|
---|
27 | 'User' => $username,
|
---|
28 | 'Pass' => $password,
|
---|
29 | 'CPCode' => '601',
|
---|
30 | 'UserID' => '841662860000',
|
---|
31 | 'RequestID' => '4',
|
---|
32 | 'ReceiverID' => '84988568786',
|
---|
33 | 'ServiceID' => '8062',
|
---|
34 | 'CommandCode' => 'SBG',
|
---|
35 | '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'),
|
---|
37 | );
|
---|
38 |
|
---|
39 | $xml = $this->load->view('mt', $aryParams, true);
|
---|
40 | $client = new nusoap_client($url);
|
---|
41 | $client->useHTTPPersistentConnection();
|
---|
42 | $client->soap_defencoding = 'UTF-8';
|
---|
43 | $client->operation = $operation;
|
---|
44 |
|
---|
45 | $result = $client->send($xmlHeader.$xml, $operation);
|
---|
46 | $err = $client->getError();
|
---|
47 |
|
---|
48 | if ($err) {
|
---|
49 | echo '<p><b>Error: ' . $err . '</b></p>';
|
---|
50 | }
|
---|
51 |
|
---|
52 | echo "<br/>";
|
---|
53 | echo "<h2>Request</h2>";
|
---|
54 | echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
|
---|
55 | echo "<h2>Response</h2>";
|
---|
56 | echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
|
---|
57 |
|
---|
58 | }
|
---|
59 | } |
---|