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
|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "vsprintf.h"
#include "request.h"
#include "headers.h"
#include "sms.h"
int WyslijSMS_Era(SMS_packet *sms)
{
char tel[20]; //, email_addr[80];
char *telefon = sms->telefon;
char *wiadomosc = sms->wiadomosc;
char *ok = sms->potwierdzenie;
int ret_val = 1;
strncat(strcpy(tel, "48"), telefon, sizeof(tel)-3);
tel[sizeof(tel)-1]=0;
HTTP_Request *s = new HTTP_Request("www.eraomnix.pl", 80,
konfig.w3cache_host, konfig.w3cache_port);
// te dane beda w kazdym odwolaniu sie do serwera
s->AddHeader("Host","www.eraomnix.pl");
Headers *form = new Headers();
form->Add("minute", "");
form->Add("number", tel);
form->Add("hour", "");
form->Add("password", konfig.omnix_pass);
form->Add("login", konfig.omnix_login);
form->Add("message", wiadomosc);
form->Add("signature", "");
form->Add("success", "http://localhost/era");
form->Add("contact", "");
form->Add("failure", "http://localhost/era");
delete s->PostData("/sms/do/extern/tinker/free/send", *form);
delete form;
ret_val = poprawna_odpowiedz(ok, telefon, s->GetBody());
delete s;
return ret_val;
/* throw new Exception("Blad obslugi strony www.eraomnix.pl");
return 0;*/
}
|