SMS Verification-How does PHP implement sending SMS?

Source: Internet
Author: User
How does PHP implement the ability to send text messages? Is there any library, do not know there is no free to send SMS this aspect of service. Ask the great God to enlighten you.

Reply content:

How does PHP implement the ability to send text messages? Is there any library, do not know there is no free to send SMS this aspect of service. Ask the great God to enlighten you.

A picture sees the approximate principle:

    • Red Request line is the focus of our attention, third-party service providers will generally use the HTTP protocol to implement the SMS API

    • To the service provider SMS official website to see the API on the line, the general will provide PHP SMS SDK

    • If not provided, can also write their own, the following example

To confirm that curl support is turned on


  
   

or directly with file_get_contents.


  
    'bar');$data = http_build_query($data); $opts = array ('http' => array ('method' => ‘POST','header'=> 'Content-type: application/x-www-form-urlencodedrn' ."Content-Length:" . strlen($data) . "rn",'content' => $data)); $context = stream_context_create($opts);$html = file_get_contents(‘https://www.baidu.com', false, $context); echo $html;// 以GET方式$url='http://www.baidu.com/';$html = file_get_contents($url);echo $html;?>

Http://www.yunpian.com

Send text message, you want to pick up third-party SMS provider, generally this will provide demo.
There are differences in each of the SMS platforms.

It doesn't matter with the library. Are services provided by third parties. You can do it on your side of the HTTP call.

Almost no free, we use Ali big fish, the speed is very fast ...
Configuration is also extremely simple. Can be sent by a GET request:
Cons: More expensive.
http://www.alidayu.com/

There are fees for third-party services can be Baidu under the SMS API

I was thinking that if the nut document will not appear a little low, hehe

$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "http://sms-api.luosimao.com/v1/send.json");curl_setopt($ch, CURLOPT_HTTP_VERSION  , CURL_HTTP_VERSION_1_0 );curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_HEADER, FALSE);curl_setopt($ch, CURLOPT_HTTPAUTH , CURLAUTH_BASIC);curl_setopt($ch, CURLOPT_USERPWD  , 'api:key-b761c24f77fc5d77769d5a442ccacc10');curl_setopt($ch, CURLOPT_POST, TRUE);curl_setopt($ch, CURLOPT_POSTFIELDS, array('mobile' => '13761428267','message' => '验证码:123456【铁壳网络】'));$res = curl_exec( $ch );curl_close( $ch );//$res  = curl_error( $ch );var_dump($res);

return Result:

{"error":0,"msg":"ok"}

HTTP://SUBMAIL.CN/CHS/DOCUMENTS/DEVELOPER/BSX2B3 submail php SMS SDK, hope to help you:)

Http://sms.mob.com/#/sms

Free of Sure no

Free of charge, there will usually be a quota for you to test. has been using http://www.yuntongxun.com, all aspects are also good, the realization is simple.

We are using the cloud, this can

We used Andro to write an app for texting cats to use.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.