SMS API

Superegoa year ago

Hi to all.
Has anyone succeeded with SMS gateway who uses API key before to make "signature" and later use that signature to send API SMS

For example. To send SMS request sample is:
https://sms.sms.com/external/get/send.php?login=xxxxxx&signature=61754abf58e31405b766ce2d38134cb2&phone=0&text=Hello!&sender=smstest&return=json&timestamp=1409887191

But in order to get signature we need:
The ready example of the simplest function of making a signature in PHP

function Signature( $params, $api_key )
{
    ksort( $params );
    reset( $params );
 
    return md5( implode( $params ) . $api_key );
}

There is a set of parameters

$params = array(
    'timestamp' => '1671599384',
    'login'     => 'YourLogin',
    'phone'     => '0',
    'sender'    => 'smstest'
    'text'      => 'Long text'
);

You should sort it alphabetically

ksort( $params );
reset( $params );

As a result you will see

Array
(
    [login] => YourLogin
    [phone] => 0
    [sender] => smstest
    [text] => Long text
    [timestamp] => 1671599384
)

Convert the result to a string

implode( $params );

As a result you will see

YourLogin0smstestLong text1671599384

Add your API key at the end of the string - 67162f948dfccd233b615db968dbb8417bfe9a4c

YourLogin0smstestLong text167159938467162f948dfccd233b615db968dbb8417bfe9a4c

Convert the result to md5 hash

md5( 'YourLogin0smstestLong text167159938467162f948dfccd233b615db968dbb8417bfe9a4c' );

Is it possible to get it all done in Traccar?

Thanks in advance

Anton Tananaeva year ago

Not without code changes.