Jump to content

Here an example for sending SMS


mierlp

Recommended Posts

Hi

In the attachment a simple example how to send a sms text message.
In this example is use www.bulksms.com for sending my sms messages
but you can have you're own one if you want.

Every sms provider has his own url for sending messages, in this case
you see the url from bulksms. So in you're own case you have to
see the documentation of the sms provider.

Most sms providers have also mail-to-sms, but for me this is a
simple low-cost solution to create you're own 2FA. 

Regards Peter

 

SendSMS.zip

  • Like 5
Link to comment
Share on other sites

  • 4 months later...
On 1/25/2019 at 11:43 PM, mierlp said:

Hi

In the attachment a simple example how to send a sms text message.
In this example is use www.bulksms.com for sending my sms messages
but you can have you're own one if you want.

Every sms provider has his own url for sending messages, in this case
you see the url from bulksms. So in you're own case you have to
see the documentation of the sms provider.

Most sms providers have also mail-to-sms, but for me this is a
simple low-cost solution to create you're own 2FA. 

Regards Peter

 

SendSMS.zip

tnx serverModule.pas  not found

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 months later...
  • 1 year later...

Thanks you very much 

 //   SEND TEXT MESSAGE VIA SEND TEXT MESSAGE VIA OPERATOR hablame.co
function enviarmensaje(p_telefono, P_mensaje:string; var P_MsgError:string) :boolean;
const
  // URL PROVEEDOR
  URL           = 'https://api101.hablame.co/api/sms/v2.1/send/';
  URLBackup     = 'https://api102.hablame.co/api/sms/v2.1/query/smsId/';
var
  Data: TStringlist;
//  returnCode: string;
  w_mensaje : string;
  IdHTTP1:TidHTTP;         // <---- USES IdHTTP
  W_STR:string;
  w_int:Integer ;
begin
  IdHTTP1   := TIdHTTP.Create(nil);
  w_mensaje := TimeToStr(now) + '->' +  P_mensaje;
  Data      := TStringList.Create;

  Data.Add('account='  + '10010651');
  Data.Add('apiKey='   + 'YtAL0wS1lk0KvDJckxsv9sDodFpyYkc');
  Data.Add('token='    + 'ae3b827512325de9dd0d461b268cbe8f');
  Data.Add('toNumber=' +  p_telefono);
  Data.Add('sms='      +  w_mensaje);
  Data.Add('sc='       +  '899991');

  // Show return code
  P_MsgError := IdHTTP1.Post(URL, Data);    //  <----- answer
  w_int :=Pos('1x000', P_MsgError);         //  <---  message sent successfully

  if w_int > 0 then
    Result:=True
  else
    Result:=False;

  Data.Free;
  IdHTTP1.Free ;

end;
 

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...