C++

 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
/* 
   SPIRIcom HTTP GET C++ example
   This example requires CURL.
   For instructions on installation
   please visit http://curl.haxx.se/libcurl
*/

#include <curl/curl.h>
#include <iostream>
#include <string>

using namespace std;

int main() {

    /* Change this to your username */
    string user = "myuser";

    /* Change this to your password */
    string pass = "mypass";

    /* This is the short message to be sent */
    string msg = "test";

    /* Sender of the short message */
    string from = "+46712345678";

    /* Recipient of the short message */
    string to = "+467123456789";

    /* Construct the URL */
    string url = "http://get.spiricom.spirius.com:55000/cgi-bin/sendsms?User" + user + "&Pass=" + pass + "&From=" + from + "&To=" + to + "&Msg=" + msg;

    /* Create and send the GET-request */
    CURL *ch = curl_easy_init();
    curl_easy_setopt(ch, CURLOPT_URL, url.c_str());
    curl_easy_perform(ch);
    curl_easy_cleanup(ch);
}
Back to top