|
|
Line 1: |
Line 1: |
| ==== How can you specify a port for sending SMS? ====
| |
| When you need to specify a port for sending SMS, you can set port parameter in the SMS sending request. If you don’t need to send SMS through a specific port, port parameter is not necessary.
| |
|
| |
|
| ==== How to match an SMS sending result with an SMS sending request? ====
| |
| It is advised to use user_id in the SMS sending request. You can use different user id when SMS is sent to a different telephone number, and then SMS sending result will also carry this user id. Each user id needs to be unique, and generally it is changed in an increasing order.
| |
|
| |
| ==== How fast can a SMS be sent? ====
| |
| It takes about 5 to 8 seconds to send a SMS message on a GSM gateway, and about 2 to 4 seconds on a LTE gateway. The time depends on the GSM network quality. When the GSM network is in a bad condition, it may take about 1 minute.
| |
|
| |
| ==== How can you get SMS delivery status? ====
| |
| Generally, it is not necessary to query delivery status, as delivery status is included in SMS sending Result. But if you want to control the SMS delivery, please see the following:
| |
|
| |
| SMS delivery status is received by gateway in unspecific time. It is connected with an SMS sending result by a ref_id. And it is better to query delivery status after SENT_OK is returned. For a long SMS message which will be divided into 3 smaller SMS segments, if the first ref_id in SMS sending result is 0 and those of other two SMS segments are 1 and 2 respectively, at least 3 delivery statuses will be received, carrying ref_id 0, 1 and 2 respectively.
| |
|
| |
| '''How can you disable SMS delivery status?'''
| |
|
| |
| Set the value of ‘request_status_report’parameter into ‘false’ in the SMS sending request.
| |
|
| |
| ==== How to send HTTP(s) request in the program? ====
| |
| C/C++ and PHP can use libcurl for sending HTTP(s) request. The parameter in libcurl is almost the same in curl utility.
| |
|
| |
| {| class="wikitable"
| |
| |curl
| |
| |libcurl
| |
| |-
| |
| |<nowiki>-k</nowiki>
| |
| |CURLOPT_SSL_VERIFYPEER,
| |
|
| |
| CURLOPT_SSL_VERIFYHOST,
| |
| |-
| |
| |<nowiki>-u</nowiki>
| |
| |CURLOPT_USERPWD
| |
| |-
| |
| |<nowiki>--anyauth</nowiki>
| |
| |CURLOPT_HTTPAUTH
| |
| |-
| |
| |<nowiki>-H</nowiki>
| |
| |CURLOPT_HTTPHEADER
| |
| |-
| |
| |<nowiki>-d</nowiki>
| |
| |CURLOPT_POSTFIELDSCURLOPT_POSTFIELDS
| |
| |}
| |
|
| |
| PHP example:
| |
|
| |
| ''$curl = curl_init($url);''
| |
|
| |
| ''curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY ) ; curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);''
| |
|
| |
| ''curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json;"));''
| |
|
| |
| ''curl_setopt($curl, CURLOPT_USERPWD, "admin:admin"); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $content); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);''
| |
|
| |
| ''curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);''
| |
|
| |
| ''curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);''
| |
|
| |
| C#, JAVA, PYTHON and other programming language have their own lib for sending http request, please check the programming manual for help.
| |