| Author |
Message |
jorge martinez
New member Username: Vampiraco
Post Number: 1 Registered: 12-2005
| | Posted on Wednesday, December 21, 2005 - 11:14 pm: | |
Hi.... I have a socket that send the sms text to my program from the smsnow gateway, but now i need to send a sms from the program, it is posible? I am using socket but i do not know how send the text to the gateway interface..... |
Yew Thean Hoo
New member Username: Theanhoo
Post Number: 2 Registered: 01-2006
| | Posted on Saturday, January 07, 2006 - 05:14 pm: | |
I suggest you use cURL (http://curl.haxx.se/) Here's how I use cURL to send an MMS: bool HTTPPost(LPCSTR PhoneNum, LPCSTR Filename) { bool rc = false; // Submit MMS using libcURL via HTTP Post CURL *curl; curl = curl_easy_init(); if (curl) { int curl_rc = 0; // Don't set verbose as NowSMS will take the response and send it back to the mobile phone user curl_easy_setopt(curl, CURLOPT_VERBOSE, 0); /* First set the URL that is about to receive our POST. This URL can just as well be a https:// URL if that is what should receive the data. */ curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:8800/"); /* Now specify the POST data */ struct curl_httppost *post=NULL; struct curl_httppost *last=NULL; curl_formadd(&post, &last, CURLFORM_COPYNAME, "PhoneNumber", CURLFORM_COPYCONTENTS, PhoneNum, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "MMSFile", CURLFORM_FILE, Filename, CURLFORM_END); /* Set the form info */ curl_easy_setopt(curl, CURLOPT_HTTPPOST, post); /* post away! */ curl_rc = curl_easy_perform(curl); /* free the post data again */ curl_formfree(post); /* always cleanup */ curl_easy_cleanup(curl); rc = true; } return rc; } It should be quite easy to modify it to send SMS.
|
|