/
example.php
141 lines (123 loc) · 6.25 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Example extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
// load library
$this->load->library('nexmo');
// set response format: xml or json, default json
$this->nexmo->set_format('json');
// **********************************Text Message*************************************
$from = 'xxxxxxxx';
$to = 'xxxxxxx';
$message = array(
'text' => 'test message'
);
$response = $this->nexmo->send_message($from, $to, $message);
echo "<h1>Text Message</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// *********************************Binary Message**************************************
/*
$from = 'xxxxxxxx';
$to = 'xxxxxxxxxx';
$message = array(
'body' => 'body message',
'udh' => 'xxxxxxx'
);
$response = $this->nexmo->send_message($from, $to, $message);
echo "<h1>Binary Message</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
*/
// *********************************Wappush Message**************************************
/*
$from = 'xxxxxxxx';
$to = 'xxxxxxxxxx';
$message = array(
'title' => 'xxxxxx',
'url' => 'xxxxxxx',
'validity' => 'xxxxxx'
);
$response = $this->nexmo->send_message($from, $to, $message);
echo "<h1>Wappush Message</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// *********************************Account - Get Balance*********************************
$response = $this->nexmo->get_balance();
echo "<h1>Account - Get Balance</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Account - Get Pricing*********************************
$response = $this->nexmo->get_pricing('TW');
echo "<h1>Account - Get Pricing</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Account - Settings*********************************
$response = $this->nexmo->get_account_settings(NULL, 'http://mlb.mlb.com', 'http://www.facebook.com');
echo "<h1>Account - Settings</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Account - Numbers*********************************
$response = $this->nexmo->get_numbers();
echo "<h1>Account - Numbers</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Account - Top-up*********************************
$trx = '00X123456Y7890123Z';
$response = $this->nexmo->get_top_up($trx);
echo "<h1>Account - Top-up</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Number - Search*********************************
$response = $this->nexmo->get_number_search('US', NULL);
echo "<h1>Number - Search</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Number - Buy*********************************
$response = $this->nexmo->get_number_buy('US', '34911067000');
echo "<h1>Number - Buy</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Number - Cancel*********************************
$response = $this->nexmo->get_number_cancel('US', '34911067000');
echo "<h1>Number - Cancel</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Number - Update*********************************
$params = array(
'moHttpUrl' => 'http://xxxxxx'
'moSmppSysType' => 'inbound'
);
$response = $this->nexmo->get_number_update('TW', '886934353293', null);
echo "<h1>Number - Update</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Search - Message*********************************
$response = $this->nexmo->search_message('0200000002A26B28');
echo "<h1>Search - Message</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Search - Messages*********************************
$ids = array('0200000002A26B28', '0200000002A26B28');
$response = $this->nexmo->search_messages($ids);
echo "<h1>Search - Messages</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
$response = $this->nexmo->search_messages(null, '2013-01-23', '886935082580');
echo "<h1>Search - Messages</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
// ********************************Search - Rejections*********************************
$response = $this->nexmo->search_rejections('2013-01-23', '886935082580');
echo "<h1>Search - Message</h1>";
$this->nexmo->d_print($response);
echo "<h3>Response Code: " . $this->nexmo->get_http_status() . "</h3>";
*/
}
}
/* End of file example.php */
/* Location: ./application/controllers/example.php */