Home >php教程 >php手册 >PHP发短信 PEAR 包:Services

PHP发短信 PEAR 包:Services

WBOY
WBOYOriginal
2016-06-06 19:44:011297browse

PHP发短信 PEAR 包:Services_Sms 对于这种第三方库,PHP官方称之为PEAR,需要按照PEAR标准开发(标准URI)。 PEAR的优势:一键安装到php/lib/php目录,require即可使用,很方便。 由于项目要发短信,所以我开发了一个,现在整理开源出来。安装步骤如下: pe

PHP发短信 PEAR 包:Services_Sms

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

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

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

pear channel-discover sinkcup.github.io/<span>pear
pear </span><span>install</span> 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):

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

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

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

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn