File: [Platon] / dead / mail2sms / sendsms.c (download)
Revision 1.8, Thu May 9 16:10:49 2002 UTC (21 years, 10 months ago) by host8
Changes since 1.7: +4 -0
lines
* Test of cvs commit (loginfo.sh changed).
* New implementation of HTTP protocol, doesn't work yet.
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "config.h"
#include "mail2sms.h"
#include "http.h"
#include "passwd.h"
// Function sendsms() {{{
int sendsms(char *str, int show_info)
{
http_init();
switch (id) {
// #ifdef ENABLE_AZET {{{
#ifdef ENABLE_AZET
case AZET:
http_request(HTTP_GET, "/index.phtml?", "sms.azet.sk", NULL);
// http_set_referer("sms2.azet.sk", "/");
http_request(HTTP_POST, "/index.phtml", "sms.azet.sk",
"Content-type: "
"application/x-www-form-urlencoded\r\n"
"Content-length: %d\r\n\r\n%s",
strlen(str), str);
break;
#endif
// }}} #endif ENABLE_AZET
// #ifdef ENABLE_WHIZDIARY {{{
#ifdef ENABLE_WHIZDIARY
case WHIZDIARY:
http_request(HTTP_GET, "/home.asp", "www.whizdiary.com", NULL);
http_request(HTTP_GET, "/noCookies.asp", "www.whizdiary.com", NULL);
http_request(HTTP_GET, "/default.asp", "www.whizdiary.com", NULL);
http_request(HTTP_GET, "/home.asp", "www.whizdiary.com", NULL);
http_request(HTTP_GET, "/sms.asp", "www.whizdiary.com", NULL);
http_request(HTTP_POST, "/sms.asp", "www.whizdiary.com",
"Content-type: "
"application/x-www-form-urlencoded\r\n"
"Content-length: %d\r\n\r\n%s",
strlen(str), str);
break;
#endif
// }}} #endif ENABLE_WHIZDIARY
// #ifdef ENABLE_SPISNET {{{
#ifdef ENABLE_SPISNET
case SPISNET:
http_request(HTTP_GET, "/top.php3", "sms.spisnet.sk", NULL);
http_request(HTTP_POST, "/smssend.php3", "sms.spisnet.sk",
"Content-type: "
"application/x-www-form-urlencoded; "
"charset=windows-1250\r\n"
"Content-length: %d\r\n\r\n%s",
strlen(str), str);
// "smsn=421903123123&chars=0&smsm=sorry%2C+test&submit=Odoslat+SMS+spr%E1vu"
break;
#endif
// }}} #endif ENABLE_SPISNET
// #ifdef ENABLE_GLOBTELNET {{{
#ifdef ENABLE_GLOBTELNET
case GLOBTELNET:
/* Begin of frames *
http_request(HTTP_GET, "/get/guest/app.php3.html",
"www.globtelnet.sk", NULL);
http_request(HTTP_GET, "/get/guest/core/core.php3.html",
"www.globtelnet.sk", NULL);
http_request(HTTP_GET, "/get/guest/app.php3:_navigator:.html",
"www.globtelnet.sk", NULL);
http_request(HTTP_GET, "/get/all/app.php3:_linkbar.html",
"www.globtelnet.sk", NULL);
* End of frames */
http_request(HTTP_GET, "/get/all/core/register.php3.html",
"www.globtelnet.sk", NULL);
/* login */
http_request(HTTP_POST, "/core/do_user.php3", "www.globtelnet.sk",
"Content-type: "
"application/x-www-form-urlencoded; "
"charset=windows-1250\r\n"
//"Content-length: 51\r\n\r\n"
"Content-length: %d\r\n\r\n"
"form_name=login"
"&next_page=&wa_na=%s&wa_pa=%s",
strlen(my_getlogin(0)) +
strlen(my_getpass(0)) + 41,
my_getlogin(1), my_getpass(1));
http_request(HTTP_POST, "/sms/do_sms_send.php3", "www.globtelnet.sk",
"Content-type: "
"application/x-www-form-urlencoded; "
"charset=windows-1250\r\n"
"Content-length: %d\r\n\r\n%s",
strlen(str), str);
http_request(HTTP_GET, "/comm/message.php3?readsess=1",
"www.globtelnet.sk", NULL);
break;
#endif
// }}} #endif ENABLE_GLOBTELNET
// #ifdef ENABLE_MTNSMS {{{
#ifdef ENABLE_MTNSMS
case MTNSMS:
http_request(HTTP_GET, "/", "www.mtnsms.com", NULL);
http_request(HTTP_POST, "http://www.mtnsms.com/session.asp",
"www.mtnsms.com",
"Content-type: "
"application/x-www-form-urlencoded\r\n"
//"Content-length: 77\r\n\r\n%s",
"Content-length: %d\r\n\r\n"
"username=%s&"
"password=%s&email=&"
"joinusclick=no&returl=",
strlen(my_getlogin(0)) +
strlen(my_getpass(0)) + 49,
my_getlogin(1), my_getpass(1));
http_request(HTTP_GET, "/members/contacts/contacts.asp",
get_last_hostname(),
NULL);
http_clean_referer(requests);
http_request(HTTP_GET, "/sms/ssms.asp",
get_last_hostname(),
NULL);
http_request(HTTP_POST, "/sms/ssms.asp",
get_last_hostname(),
"Content-type: "
"application/x-www-form-urlencoded; "
"Content-length: %d\r\n\r\n%s",
strlen(str), str);
// "dummy=&smsToNumbers=421903838302&smsMessage=send+this+message+to+me&smsSig=0&smsSigDyna=rajo&lenSSig=5&lenLSig=5&lenSysSig=11"
//http_request(HTTP_GET, "/sms/outbox.asp", "www4.mtnsms.com", NULL);
//http_request(HTTP_GET, "/logout.asp", "www4.mtnsms.com", NULL);
//http_request(HTTP_GET, "/default.asp?fromLogout=true&name=rajo", "www4.mtnsms.com", NULL);
break;
#endif
// }}} #endif ENABLE_MTNSMS
default:
fprintf(stderr, "Somethings go wrong, "
"invalid id in sendsms()!\n");
exit(1);
break;
} /* end switch (id) */
if (show_info)
fprintf(stderr, "text to sms [%d chars]:'%s'\n",
strlen(str), str);
free_requests(requests);
return(0);
} // }}}
/* Modeline for ViM {{{1
* vim:set ts=4:
* vim600:fdm=marker fdl=0 fdc=3:
* }}}1 */
Platon Group <platon@platon.org> http://platon.org/
|