This PHP sms library allows you to send, receive, delete and mark messages from PHP with http requests. The library uses HTTP Post requests and JSON encoded content to send the text messages to the mobile network. It uses the HTTP SMS api of the Ozeki SMS gateway
Ozeki SMS Gateway is a powerful and reliable SMS Gateway software that can be installed to Windows, Linux and to an Android phone as well. Your data is in safe hands with the Ozeki SMS Gateway because it runs in an environment that only you control. It provides an HTTP SMS API, that allows you to connect to it from local or remote programs. It is totally independent from service providers, so It could be used in any country, offering direct access to service providers through wireless connections. This library enables you to use the Ozeki SMS Gateway as your SMS Gateway.
Download: Ozeki SMS Gateway download page
Tutorial: How to send SMS from PHP
To send sms from PHP
- Install Ozeki SMS Gateway
- Connect Ozeki SMS Gateway to the mobile network
- Create a HTTP sms api user
- Start Wamp server
- Download the example above
- Create the SMS by creating a new Message object
- Use the SendSingle method to send your message
- Read the HTTP response 10 .Check the logs in the SMS gateway
To use the code you need to import the Ozeki.Libs.Rest.Php sms library, which gives you all the tools neccessary to send and receive SMS messages. This sms library is also included in this repository with it's full source code. After the library is imported with the using statement, create a user with a username of "http_user", and with a password of "qwe123" to make the example work without modification. The URL is the default http api URL to connect to your SMS gateway. Note that the IP address (127.0.0.1) should be replaced to the IP address of your SMS gateway.
namespace Ozeki_PHP_Rest
{
require 'MessageApi/MessageApi.php';
$configuration = new Configuration();
$configuration -> Username = "http_user";
$configuration -> Password = "qwe123";
$configuration -> ApiUrl = "http://192.168.0.113:9509/api";
$msg = new Message();
$msg -> ToAddress = "+36201111111";
$msg -> Text = "Hello, World!";
$api = new MessageApi($configuration);
$result = $api -> SendSingle($msg);
echo strval($result);
}
In order to understand the SMS code sample better, we provide you a manual webpgae that explains this code in a detailed way with the help of video tutorials. You can get the downloadable content and the explanatory screenshots on the webpage aswell. Link: How to send sms from PHP
Don't waste any time, start working with the repository and send your first SMS!