|
Anveo.com - BulkSMS HTTP Gateway and SMS API
|
|
|
|
|
|
Overview
|
|
|
Anveo provides BulkSMS HTTP Gateway to send and receive SMS/Text messages.
|
|
|
HTTP Request
|
|
Anveo SMS API is using HTTP REST to submit SMS Text Messages.
Both POST and GET methods are supported.
HTTP URL format to send SMS message:
|
|
|
https://www.anveo.com/api/v1.asp?apikey=YOURAPIKEY&action=sms&from=FROMPHONENUMBER&destination=DESTINATIONPHONENUMBER&message=TEXTOFTHEMESSAGE
|
|
where
apikey [required] is your API KEY from Anveo API
from [optional] is a phone number which will be displayed as the sender of the SMS message. SMS replies will se sent to that phone number.
If you have Anveo phone number with SMS support you can specify that number to implement 2-way SMS.
destination [required] is a destination phone number for SMS message.
message [required] SMS Text Message.
sms_type [optional] indicates if message is a regular text message or binary message. Possible values are text and binary. Binary message data should be HEX16 encoded.
port [optional] destination port for binary SMS messages. Port should be HEX16 encoded.
|
|
|
Phone number format for from and destination is Country Code + Area Code + Phone Number.
|
|
|
Result
|
Anveo returns the status of SMS API as a text.
The format of the result text message is as following:
result=AAAAAAAA^error=BBBBBBBB^parts=N^fee=ZZZ^smsid=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
where
AAAAAAAA - is success when SMS message was sent succesfully and error when there was an error while processing SMS.
BBBBBBBB - error text.
N - total number of SMS parts used to deliver SMS message. In most cases that number will be 1, however since Anveo supports sending Long SMS messages and in such cases the number of parts could be more then 1.
ZZZ - the total cost (in USD) of sending SMS message.
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY - unique SMS messageid. SMSID is used by SMS delivery report notification (See Async. Event Notifications)
|
|
|
Example (Success)
|
Send SMS (success):
https://www.anveo.com/api/v1.asp?apikey=23423423423423asdasd3423asd&action=sms&from=12157010000&destination=12157010680&message=this%20is%20test%20message
Result
result=success^error=^parts=1^fee=0.044
|
|
|
Example (Error)
|
Send SMS (error):
https://www.anveo.com/api/v1.asp?apikey=23423423423423asdasd3423asd&action=sms&from=12157010000&destination=&message=this%20is%20test%20message
Result
result=error^error=destination phone number is missing or invalid.
|
|
|
PHP Code Sample
|
#!/usr/bin/php -q
<?php
/**
* Anveo SMS API script v1.0
*
* PHP Script for sending SMS thru Anveo.com http gateway
*
* PHP versions 4 and 5 compiled with curl and https support
* LICENSE: FREE
*
* @author Anveo.com
*/
/**
* USAGE
* SendSMS(<to_number>,<from_number>,<message>)
*
*/
function SendSMS($to_number,$from_number,$message){
$apikey="- YOUR API KEY -"; //CHANGE ME
echo "Sending sms ...\n";
// need curl with https if using https://
$ch = curl_init ("https://www.anveo.com/api/v1.asp?apikey=".$apikey."&action=sms&destination=".$to_number."&from=".$from_number."&message=".urlencode($message));
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result=curl_exec ($ch);
curl_close ($ch);
/*parse the result*/
$records_array=explode('^',$result);
foreach($records_array as $record){
$field_array=explode('=',$record);
if (is_array($field_array)){
$map[$field_array[0]]=$field_array[1];
}
}
echo "result:".$map["result"]."\n\n";
echo "error text:".$map["error"]."\n";
echo "parts:".$map["parts"]."\n";
echo "fee:".$map["fee"]."\n";
}
?>
|
|