-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.cc
More file actions
35 lines (27 loc) · 1012 Bytes
/
simple.cc
File metadata and controls
35 lines (27 loc) · 1012 Bytes
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
// Simple example sending a text message via the websms.com services.
#include <stdio.h>
#include <iostream>
#include <websms/websms.h>
int main() {
using namespace websms;
printf("Sending text SMS using %s ...\n", Version());
// Create the client.
SmsClient client("user", "password", "https://api.websms.com/json");
// Create new message with one recipient. You can also address multiple
// recipients by passing in a vector.
TextMessage message(1234567, UTF8("Hello World!"));
try {
// Send the message.
MessageResponse response = client.Send(message,
1, // Max. sms per message
false); // Test message?
// Print the response.
printf("Status message: %s\nStatus code: %d\n",
response.status_message(),
response.status_code());
} catch (const Exception& e) {
// Handle exceptions.
fprintf(stderr, "Exception: %s \n", e.What());
}
return 0;
}