ismaeltoe/osms
最新稳定版本:v2.0.2
Composer 安装命令:
composer require ismaeltoe/osms
包简介
PHP library wrapper of the Orange SMS API.
关键字:
README 文档
README
A PHP library to access Orange SMS API.
Current version: 2.0.2
Installation
With Composer (recommended)
Install Composer. Then, do:
$ composer require ismaeltoe/osms
Without Composer
Simply download the latest release.
Loading
You can load the class using Composer's autoloading:
require 'vendor/autoload.php';
Otherwise, you can simply require the file directly:
require 'path/to/Osms.php';
Quick Start
Case 1: You have no access token
require 'vendor/autoload.php'; use \Osms\Osms; $config = array( 'clientId' => 'your_client_id', 'clientSecret' => 'your_client_secret' ); $osms = new Osms($config); // retrieve an access token $response = $osms->getTokenFromConsumerKey(); if (!empty($response['access_token'])) { $senderAddress = 'tel:+2250000'; $receiverAddress = 'tel:+22500000000'; $message = 'Hello World!'; $senderName = 'Optimus Prime'; $osms->sendSMS($senderAddress, $receiverAddress, $message, $senderName); } else { // error }
Case 2: You have an access token
require 'vendor/autoload.php'; use \Osms\Osms; $config = array( 'token' => 'your_access_token' ); $osms = new Osms($config); $senderAddress = 'tel:+2250000'; $receiverAddress = 'tel:+22500000000'; $message = 'Hello World!'; $senderName = 'Optimus Prime'; $osms->sendSMS($senderAddress, $receiverAddress, $message, $senderName);
Check out examples for more examples.
CHECK OUT also Osms.php to see all the methods available. But DON'T MODIFY IT. You can extend the class to add your own stuff.
Country Sender Number
The sender address is a unique country sender number per country. You can find the list of country sender numbers here.
SSL certificate problem
If you get an SSL error, set the peer's certificate checking option to false:
$osms = new Osms(); $osms->setVerifyPeerSSL(false);
But it should work on your hosting server, so enable the certificate checking when you are ready to deploy your application for security reasons.
Documentation
Other Libraries
License
Released under the MIT License - see LICENSE.txt for details.
统计信息
- 总下载量: 39.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 46
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-10