Home  >  Article  >  Backend Development  >  PHP text messaging PEAR package: Services_Sms_PHP tutorial

PHP text messaging PEAR package: Services_Sms_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:15:37904browse

PHP text messaging PEAR package: Services_Sms

For this third-party library, PHP officially calls it PEAR and needs to be developed according to the PEAR standard (standard URI).

Advantages of PEAR: One-click installation to the php/lib/php directory, require to use, very convenient.

Since the project involves sending text messages, I developed one and now I have compiled it and made it open source. The installation steps are as follows:

pear channel-discover sinkcup.github.io/<span pear
pear </span><span install</span> sinkcup/Services_Sms

Version 0.0.1 supports the following SMS service providers:

Etonenet: http://www.etonenet.com/

SMS Bao: http://smsbao.com/

Huyi unlimited: http://ihuyi.com/

Usage steps:

1. Register an account on the SMS service provider’s website, such as Etonenet (http://www.etonenet.com/).

2. demo (refer to 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>?>

Source code: https://github.com/sinkcup/Services_Sms

sinkcup PEAR channel: http://sinkcup.github.io/pear/

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440184.htmlTechArticlePHP sends SMS PEAR package: Services_Sms For this third-party library, PHP officially calls it PEAR, and you need to follow PEAR Standard development (standard URI). Advantages of PEAR: One-click installation to the php/lib/php directory...
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