PHP发短信 PEAR 包:Services_Sms

PHP发短信 PEAR 包:Services_Sms

对于这种第三方库,PHP官方称之为PEAR,需要按照PEAR标准开发(标准URI)。

PEAR的优势:一键安装到php/lib/php目录,require即可使用,很方便。

由于项目要发短信,所以我开发了一个,现在整理开源出来。安装步骤如下:

pear channel-discover sinkcup.github.io/pear
pear install sinkcup/Services_Sms

0.0.1版支持下列短信服务商:

移通网络:http://www.etonenet.com/

短信宝:http://smsbao.com/

互亿无限:http://ihuyi.com/

使用步骤:

1、到短信服务商网站注册一个帐号,比如移通网络(http://www.etonenet.com/)。

2、demo(参考https://github.com/sinkcup/Services_Sms/blob/master/tests/Services/SmsTest.php):

<?php
require_once 'Services/Sms.php';
$conf = array(
    'spid' => 'foo',
    'sppassword' => 'bar',
    'apiUriPrefix' => 'http://esms.etonenet.com/',
);
$c = new Services_Sms('etonenet', $conf);
$r = $c->send('13800138000', 'Hello!树先生 etonenet');
var_dump($r);
exit;
?>

源代码:https://github.com/sinkcup/Services_Sms

sinkcup PEAR 频道:http://sinkcup.github.io/pear/

 

posted @ 2013-08-15 17:57  sink_cup  阅读(1984)  评论(1编辑  收藏  举报
Creative Commons License

本站原创作品采用知识共享署名 3.0许可协议进行许可。