飞信是由中国移动通信集团公司推出的一款集商务应用和娱乐功能为一体的,基于手机应用以及与Internet深度互通的即时通讯产品,可免费给好友发送短信。

  1、下载中国移动飞信PC客户端软件(http://www.fetion.com.cn/downloads/pc.aspx),并注册开通飞信。注册成为飞信用户,下载飞信PC客户端、使用PC客户端基本功能,不收取费用。
  2、通过PC客户端,邀请并添加免费短信接收方的手机号码(仅限中国移动)到您的飞信好友,该手机号需要通过通过PC客户端、或回复短信接受您的邀请;
  3、通过 http://sms.api.bz/ 提供的 API 接口,即可免费给飞信好友或给你自己的手机发短信。利用本API接口可进行日程提醒、服务器监控、报警、故障通知或短信自动控制等功能。


  飞信免费发短信API接口在线演示: http://sms.api.bz/

  飞信免费发短信API接口调用方式(通过HTTP访问以下网址、支持GET和POST):

http://sms.api.bz/fetion.php?username=您的移动飞信登录手机号&password=您的移动飞信登录密码&sendto=接收短信的飞信好友手机号(也可以是你自己的手机号)&message=短信内容

  注:短信内容最大长度为180个汉字,超过180个汉字不发送。返回的信息为UTF-8编码的中文文本信息。


  例1:在Linux命令行下通过curl命令给自己的手机号(假设为13800138000)发送短信

curl "http://sms.api.bz/fetion.php?username=13800138000&password=123456&sendto=13800138000&message=短信内容"

  例2:在PHP5中通过file_get_contents函数发送短信(HTTP GET 方式)

view plain print ?
  1. <?php
  2. $url = "http://sms.api.bz/fetion.php?username=13812345678&password=123456&sendto=13512345678&message=短信内容";
  3. $result = file_get_contents($url);
  4. echo $result; //返回信息默认为UTF-8编码的汉字,如果你的页面编码为gb2312,请使用下行语句输出返回信息。
  5. //echo iconv("UTF-8", "GBK", $result);
  6. ?>

<?php $url = "http://sms.api.bz/fetion.php?username=13812345678&password=123456&sendto=13512345678&message=短信内容"; $result = file_get_contents($url); echo $result; //返回信息默认为UTF-8编码的汉字,如果你的页面编码为gb2312,请使用下行语句输出返回信息。 //echo iconv("UTF-8", "GBK", $result); ?>
  例3:在PHP中通过curl发送短信(HTTP POST 方式)

view plain print ?
  1. <?php
  2. $data["username"] = 13812345678;
  3. $data["password"] = "password123";
  4. $data["sendto"] = 13512345678;
  5. $data["message"] = "这是一条测试短信!";
  6. $curl = new Curl_Class();
  7. $result = @$curl->post("http://sms.api.bz/fetion.php", $data);
  8. echo $result; //返回信息默认为UTF-8编码的汉字,如果你的页面编码为gb2312,请使用下行语句输出返回信息。
  9. //echo iconv("UTF-8", "GBK", $result);
  10. //curl类
  11. class Curl_Class
  12. {
  13. function Curl_Class()
  14. {
  15. return true;
  16. }
  17. function execute($method, $url, $fields = '', $userAgent = '', $httpHeaders = '', $username = '', $password = '')
  18. {
  19. $ch = Curl_Class::create();
  20. if (false === $ch)
  21. {
  22. return false;
  23. }
  24. if (is_string($url) && strlen($url))
  25. {
  26. $ret = curl_setopt($ch, CURLOPT_URL, $url);
  27. }
  28. else
  29. {
  30. return false;
  31. }
  32. //是否显示头部信息
  33. curl_setopt($ch, CURLOPT_HEADER, false);
  34. //
  35. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  36. if ($username != '')
  37. {
  38. curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);
  39. }
  40. $method = strtolower($method);
  41. if ('post' == $method)
  42. {
  43. curl_setopt($ch, CURLOPT_POST, true);
  44. if (is_array($fields))
  45. {
  46. $sets = array();
  47. foreach ($fields AS $key => $val)
  48. {
  49. $sets[] = $key . '=' . urlencode($val);
  50. }
  51. $fields = implode('&',$sets);
  52. }
  53. curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
  54. }
  55. else if ('put' == $method)
  56. {
  57. curl_setopt($ch, CURLOPT_PUT, true);
  58. }
  59. //curl_setopt($ch, CURLOPT_PROGRESS, true);
  60. //curl_setopt($ch, CURLOPT_VERBOSE, true);
  61. //curl_setopt($ch, CURLOPT_MUTE, false);
  62. curl_setopt($ch, CURLOPT_TIMEOUT, 10);//设置curl超时秒数
  63. if (strlen($userAgent))
  64. {
  65. curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
  66. }
  67. if (is_array($httpHeaders))
  68. {
  69. curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders);
  70. }
  71. $ret = curl_exec($ch);
  72. if (curl_errno($ch))
  73. {
  74. curl_close($ch);
  75. return array(curl_error($ch), curl_errno($ch));
  76. }
  77. else
  78. {
  79. curl_close($ch);
  80. if (!is_string($ret) || !strlen($ret))
  81. {
  82. return false;
  83. }
  84. return $ret;
  85. }
  86. }
  87. function post($url, $fields, $userAgent = '', $httpHeaders = '', $username = '', $password = '')
  88. {
  89. $ret = Curl_Class::execute('POST', $url, $fields, $userAgent, $httpHeaders, $username, $password);
  90. if (false === $ret)
  91. {
  92. return false;
  93. }
  94. if (is_array($ret))
  95. {
  96. return false;
  97. }
  98. return $ret;
  99. }
  100. function get($url, $userAgent = '', $httpHeaders = '', $username = '', $password = '')
  101. {
  102. $ret = Curl_Class::execute('GET', $url, '', $userAgent, $httpHeaders, $username, $password);
  103. if (false === $ret)
  104. {
  105. return false;
  106. }
  107. if (is_array($ret))
  108. {
  109. return false;
  110. }
  111. return $ret;
  112. }
  113. function create()
  114. {
  115. $ch = null;
  116. if (!function_exists('curl_init'))
  117. {
  118. return false;
  119. }
  120. $ch = curl_init();
  121. if (!is_resource($ch))
  122. {
  123. return false;
  124. }
  125. return $ch;
  126. }
  127. }
  128. ?>

<?php $data["username"] = 13812345678; $data["password"] = "password123"; $data["sendto"] = 13512345678; $data["message"] = "这是一条测试短信!"; $curl = new Curl_Class(); $result = @$curl->post("http://sms.api.bz/fetion.php", $data); echo $result; //返回信息默认为UTF-8编码的汉字,如果你的页面编码为gb2312,请使用下行语句输出返回信息。 //echo iconv("UTF-8", "GBK", $result); //curl类 class Curl_Class { function Curl_Class() { return true; } function execute($method, $url, $fields = '', $userAgent = '', $httpHeaders = '', $username = '', $password = '') { $ch = Curl_Class::create(); if (false === $ch) { return false; } if (is_string($url) && strlen($url)) { $ret = curl_setopt($ch, CURLOPT_URL, $url); } else { return false; } //是否显示头部信息 curl_setopt($ch, CURLOPT_HEADER, false); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if ($username != '') { curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password); } $method = strtolower($method); if ('post' == $method) { curl_setopt($ch, CURLOPT_POST, true); if (is_array($fields)) { $sets = array(); foreach ($fields AS $key => $val) { $sets[] = $key . '=' . urlencode($val); } $fields = implode('&',$sets); } curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); } else if ('put' == $method) { curl_setopt($ch, CURLOPT_PUT, true); } //curl_setopt($ch, CURLOPT_PROGRESS, true); //curl_setopt($ch, CURLOPT_VERBOSE, true); //curl_setopt($ch, CURLOPT_MUTE, false); curl_setopt($ch, CURLOPT_TIMEOUT, 10);//设置curl超时秒数 if (strlen($userAgent)) { curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); } if (is_array($httpHeaders)) { curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders); } $ret = curl_exec($ch); if (curl_errno($ch)) { curl_close($ch); return array(curl_error($ch), curl_errno($ch)); } else { curl_close($ch); if (!is_string($ret) || !strlen($ret)) { return false; } return $ret; } } function post($url, $fields, $userAgent = '', $httpHeaders = '', $username = '', $password = '') { $ret = Curl_Class::execute('POST', $url, $fields, $userAgent, $httpHeaders, $username, $password); if (false === $ret) { return false; } if (is_array($ret)) { return false; } return $ret; } function get($url, $userAgent = '', $httpHeaders = '', $username = '', $password = '') { $ret = Curl_Class::execute('GET', $url, '', $userAgent, $httpHeaders, $username, $password); if (false === $ret) { return false; } if (is_array($ret)) { return false; } return $ret; } function create() { $ch = null; if (!function_exists('curl_init')) { return false; } $ch = curl_init(); if (!is_resource($ch)) { return false; } return $ch; } } ?>

中国移动飞信免费发短信API接口(第三方)相关推荐

  1. 中国移动飞信免费发短信API接口(第三方 Fetion API)

    [文章作者:张宴 本文版本:v1.1 最后修改:2010.08.03 转载请注明原文链接: http://blog.s135.com/fetion_api/ ] 备注:2010年7月底移动飞信修改协议 ...

  2. 中国移动飞信免费发短信API接口

    飞信是由中国移动通信集团公司推出的一款集商务应用和娱乐功能为一体的,基于手机应用以及与Internet深度互通的即时通讯产品,可免费给好友发送短信. 1.下载中国移动飞信PC客户端软件(http:// ...

  3. 中国移动飞信免费发短信API接口(第三方) 1

    Code [文章作者:张宴 本文版本:v1.0 最后修改:2009.03.22 转载请注明原文链接:http://blog.s135.com/fetion_api/] 飞信是由中国移动通信集团公司推出 ...

  4. 中国移动飞信免费发短信API接口(第三方 Fetion API

    飞信 是由中国移动通信集团公司推出的一款集商务应用和娱乐功能为一体的,基于手机应用以及与Internet深度互通的即时通讯产品,可免费给好友发送短信. 1.下载中国移动飞信PC客户端软件(http:/ ...

  5. 发布FetionAPI 中国移动飞信免费发短信API接口

    [url]http://www.cnbeta.com/articles/82231.htm[/url] 中国移动-飞信好友API http://fetionapi.appspot.com/api/?m ...

  6. 飞信免费发短信API接口调用方式

    飞信免费发短信API接口调用方式(通过HTTP访问以下网址.支持GET和POST): http://sms.api.bz/fetion.php?username=您的移动飞信登录手机号&pas ...

  7. 飞信免费发短信API

    飞信免费发短信API接口调用方式(通过HTTP访问以下网址.支持GET和POST): http://sms.api.bz/fetion.php?username=移动飞信登录手机号&passw ...

  8. PHP实现飞信接口来通过网页免费发短信

    首先感谢郝同学告诉我这么一个神奇的接口 可以输入你的手机号.密码.对方手机号.发送内容直接给对方发短信. 源作者博客地址为:http://blog.quanhz.com/ 郝同学的博客地址:http: ...

  9. 用移动飞信。。免费下载,免费发短信!

    用移动飞信..免费下载,免费发短信! http://tt.ovooo.cn/2_16_1121714.aspx

最新文章

  1. 15篇论文全面概览BERT压缩方法
  2. 真正理解线程上下文类加载器(多案例分析)
  3. 5G NR — 国内运营商的频段和带宽划分
  4. 【408预推免复习】操作系统之存储器管理
  5. 第十节 字符串指针变量与字符数组的区别(十一)
  6. Hadoop的伪分布式安装
  7. Java 多线程(一) 基础知识与概念
  8. 使用vue组件搭建网页应用
  9. 白话解说:阻塞和非阻塞,同步和异步
  10. 计算机2级什么时间考,全国计算机2级考试什么时间出成绩单
  11. 大物实验总结模板_期中总结大会amp;期末动员大会
  12. clone git 修改保存路径_用git管理版本,你必须知道的事情
  13. vue.js项目中,关于element-ui完整引入、按需引入的介绍
  14. 内核中的notification chain浅析
  15. 【前端 · 面试 】HTTP 总结(六)—— HTTP 版本区别
  16. 时间格式 asp.net
  17. SDN/NFV在演进中探寻路径
  18. 广义线性模型 逻辑回归与softmax的推导
  19. Linux 系统 nohup 命令详解
  20. 用u盘装linux系统的操作全程图解,笔者教你用u盘装系统的操作全程图解

热门文章

  1. WWW2021论文速递:细粒度城市流量预测
  2. 美团点评java开发面试问题
  3. C语言dialog函数用法,DialogBox用法
  4. Hyperf Casbin适配于Hyperf 的开源访问控制框架Casbin
  5. 【附源码】计算机毕业设计SSM天气预报查询管理系统
  6. 加州伯克利市计划发起“首次社区发行”,发售代币化债券
  7. postgresql扩展Geometry类型
  8. 后台弹出提示信息方法
  9. OFsuite亮相SDNFV Fest测试论坛 控制器性能测试成看点
  10. js截取字符串(从后往前截)