smslink / smsgateway
SMSLink.ro is a leading SMS service provider that sends more than 175 million SMS each year. Send SMS to all mobile networks in Romania and also to more than 168 countries and more than 1000 mobile operators worldwide.
This package is auto-updated.
Last update: 2025-03-18 15:41:59 UTC
README
This is an integration example for sending SMS using SMSLink.ro API, called SMS Gateway. SMSLink.ro allows you to send SMS to all mobile networks in Romania and also to more than 168 countries and more than 1000 mobile operators worldwide.
Installation
Using Composer (Dependency Manager for PHP)
$ composer require smslink/smsgateway
smslink/smsgateway Package on Packagist - The PHP Package Repository
Requirements
- Create an account on SMSLink.ro
- Create a SMS Gateway connection at SMSLink.ro / SMS Gateway / Configuration & Settings. Each SMS Gateway connection is a pair of Connection ID and Password.
Supported Functions
- $Connection->sendMessage() - sends an SMS
- $Connection->accountBalance() - retrieve SMSLink account balance
Features
- Supports HTTP and HTTPS protocols
- Supports PHP cURL GET, PHP cURL POST and file_get_contents()
System Requirements
- PHP 5 or greater with PHP cURL library or file_get_contents with allow_url_fopen to be set to 1 in php.ini
- Composer - Dependency Manager for PHP
- smslink/smsgateway Package on Packagist - The PHP Package Repository
Usage Example using Composer
<?php /* * * Require Autoload (change autoload.php path to match your project) * */ require_once 'vendor/autoload.php'; /* * * Include the SMSLink\SMSGateway\Connection namespace * */ use SMSLink\SMSGateway\Connection; /* * * * Initialize SMS Gateway * * Get your SMSLink / SMS Gateway Connection ID and Password from * https://www.smslink.ro/get-api-key/ * * * */ $Connection = new Connection(); $Connection->setConnectionCredentials("MyConnectionID", "MyConnectionPassword"); /* * Sets the method in which the parameters are sent to SMS Gateway * * 1 for cURL GET (make sure you have PHP cURL installed) (default and recommended) * 2 for cURL POST (make sure you have PHP cURL installed) * 3 for file_get_contents (requires allow_url_fopen to be set to 1 in php.ini) * (recommended if you do not have PHP cURL installed) */ $Connection->setRequestMethod(1); /* * Sets the protocol that will be used by SMS Gateway (HTTPS or HTTP). */ $Connection->setProtocol("HTTPS"); /* * Display account balance before sending SMS */ $accountBalance = $Connection->accountBalance(); echo "My Account Balance is: ".$accountBalance["national-SMS"]." national SMS, ". $accountBalance["international-SMS"]." national SMS<br />"; /* * Sends SMS #1 */ $messageId = $Connection->sendMessage("07xyzzzzzz", "My first hello world message."); if ($messageId == false) echo "Message sent failed. Log: ".$Connection->getLastLogMessage().".<br />"; else echo "Message successfully sent with ID: ".$messageId.".<br />"; /* * Sends SMS #2 */ $messageId = $Connection->sendMessage("07xyzzzzzz", "My second hello world message."); if ($messageId == false) echo "Message sent failed. Log: ".$Connection->getLastLogMessage().".<br />"; else echo "Message successfully sent with ID: ".$messageId.".<br />"; /* * Display account balance after sending SMS */ $accountBalance = $Connection->accountBalance(); echo "My Account Balance is: ".$accountBalance["national-SMS"]." national SMS, ". $accountBalance["international-SMS"]." national SMS<br />"; /* * Display the communication log with SMSLink */ $Connection->displayLogMessages(); ?>
Usage Example without using Composer
SMSLink.ro SMS Gateway can also be used without Composer. For using SMSLink SMS Gateway without Composer see the following example.
Documentation
The complete documentation of the SMSLink - SMS Gateway API can be found here, describing all available APIs (HTTP GET / POST, SOAP / WSDL, JSON and more).
Additional modules and integrations
SMSLink also provides modules for major eCommerce platforms (on-premise & on-demand), integrations using Microsoft Power Automate, Zapier or Integromat and many other useful features. Read more about all available features here.
Support
For technical support inquiries contact us at contact@smslink.ro or by using any other available method described here.