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 POST or GET requests to submit SMS Text Messages.
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 [required] phone number.
NOTE
SMS messages to US phone number can only be send from your Anveo phone number in US.
SMS messages to Canadian phone number can only be send must your Anveo phone number in Canada.
destination [required] is a destination phone number for SMS message (including country code).
message [required] SMS Text Message.
|
|
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";
}
?>
|
|