PHP发短信 PEAR 包:Services

it2025-04-04  18

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/

 

转载于:https://www.cnblogs.com/sink_cup/p/PHP-PEAR-Services_Sms.html

相关资源:数据结构—成绩单生成器
最新回复(0)