php使用ICQ网关发送手机短信

通过ICQ网关发送手机短信的php源程序


代码如下:

<?
//###########################################################
//
// For questions and comments
// Roland (alias -=: Vlieg :=-)
// icq #78354631
// mail: vlieg@atoomnet.net
//
// NB: This script won't work on free hosting pages, because of the secure mode!
// NB: You must have registered your ICQ# at http://web.icq.com/sms/login/ in order for this script to work
//###########################################################

//****************************************************************\//Config:
$uin=""; //your ICQ number
$passw=""; //your ICQpassWord
$PRefix=""; //sms prefix
$phonenumber=""; //sms phone number
$message = "Hello!"; //sms message

//****************************************************************\// EN: calculate the content length
$contentlength= ( 37+
strlen($uin)+
strlen($passw)
);
//****************************************************************\// Openen van de inlogpagina
// EN: open loginpage
$htmlreply="";
$post ="POST http://web.icq.com/karma/dologin/1,,,00.html HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-Powerpoint, application/vnd.ms-Excel, application/msword, */*
Referer: http://web.icq.com/sms/login/1,,,00.html
Accept-Language: nl
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Host: web.icq.com
Content-Length: ".$contentlength."
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: uin=".$uin."; sms_country=".$prefix."; KarmaService1=Yes; uin=".$uin."; sms_country=".$prefix."; KarmaService1=Yes
uService=1&uLogin=".$uin."&uPassword=".$passw."&x=0&y=0";
$remote = fsockopen("web.icq.com", 80, &$errno, &$errstr, 30);
global $remote;
global $post;
fputs($remote, $post);
while (!feof($remote)) { $htmlreply.=fgets($remote,120); }
//UNCOMMENT FOR OUTPUT: echo "".htmlspecialchars($htmlreply)."";
fclose($remote);
//****************************************************************\//persoonlijke cookie uit de inlogpage halen
// EN: fetch personal cookie from login page
$splited = split("\n",$htmlreply);
$cookies = $splited[3];
$cookies = str_replace("Set-Cookie: KarmaLogin=","",$cookies);
$cookies = str_replace("; path=/","",$cookies);
$cookies = str_replace("\n","",$cookies);
//UNCOMMENT VOOR OUTPUT: echo $cookies;
if (strlen($prefix) == 2) { $contentprefix = ' '.$prefix; } else { $contentprefix = $prefix; }
$charcount = (160-strlen($message));
$contentlength= ( 1561+
strlen($message)+
strlen($charcount)+
strlen($phonenumber)+
strlen($prefix)
);
//****************************************************************\//Verzendpagina openen met de opgehaalde cookie
// EN: open send page with fetched cookie
$htmlreply="";
$post ='POST http://web.icq.com/sms/send_history/1,,,00.html HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
Referer: http://web.icq.com/sms/send_session/1,,,00.html?prefix=+'.$prefix.'&carrier=&tophone='.$phonenumber.'
Accept-Language: nl
Content-Type: multipart/form-data; boundary=---------------------------7d12442eab4
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Host: web.icq.com
Content-Length: '.$contentlength.'
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: uin='.$uin.'; sms_country='.$prefix.'; KarmaService1=Yes; KarmaLogin='.$cookies.'; uin='.$uin.'; sms_country='.$prefix.'; KarmaService1=Yes; KarmaLogin='.$cookies.'
-----------------------------7d12442eab4
Content-Disposition: form-data; name="carrier"

-----------------------------7d12442eab4
Content-Disposition: form-data; name="prefix"
'.$contentprefix.'
-----------------------------7d12442eab4
Content-Disposition: form-data; name="tophone"
'.$phonenumber.'
-----------------------------7d12442eab4
Content-Disposition: form-data; name="uSession"
1
-----------------------------7d12442eab4
Content-Disposition: form-data; name="uReply"

-----------------------------7d12442eab4
Content-Disposition: form-data; name="uLastId"

-----------------------------7d12442eab4
Content-Disposition: form-data; name="uSend"
1
-----------------------------7d12442eab4
Content-Disposition: form-data; name="uNextId"

-----------------------------7d12442eab4
Content-Disposition: form-data; name="uHistoryCounter"
1
-----------------------------7d12442eab4
Content-Disposition: form-data; name="count"
0
-----------------------------7d12442eab4
Content-Disposition: form-data; name="uSubmitCount"
0
-----------------------------7d12442eab4
Content-Disposition: form-data; name="checkNewMsg"
180000
-----------------------------7d12442eab4
Content-Disposition: form-data; name="charcount"
'.$charcount.'
-----------------------------7d12442eab4
Content-Disposition: form-data; name="msg"
'.$message.'
-----------------------------7d12442eab4
Content-Disposition: form-data; name="x"
30
-----------------------------7d12442eab4
Content-Disposition: form-data; name="y"
16
-----------------------------7d12442eab4--
';
$remote = fsockopen("web.icq.com", 80, &$errno, &$errstr, 30);
global $remote;
global $post;
fputs($remote, $post);
while (!feof($remote)) { $htmlreply.=fgets($remote,120); }
//UNCOMMENT FOR OUTPUT: echo "".htmlspecialchars($htmlreply)."";
fclose($remote);
//****************************************************************\// check if message is send if send 'moved permanently' is returned
if (eregi('Moved Permanently',$htmlreply))
{ echo "Sms message successfully sent!"; }
else
{ echo "Sms not sent!"; }
?>

(0)

相关推荐

  • php实现的IMEI限制的短信验证码发送类

    php实现的IMEI限制的短信验证码发送类 <?php class Api_Sms{ const EXPIRE_SEC = 1800; // 过期时间间隔 const RESEND_SEC = 60; // 重发时间间隔 const ONE_DAY_FREQ = 5; // 每日向同一个手机号发短信的次数 const ONE_DAY_IMEI_COUNT = 3; // 每日向同一个手机号发送短信的IMEI个数 public $error = array(); /** * 向指定手机号发送验证码

  • 基于PHP实现商品成交时发送短信功能

    最近做了一个项目,其中有需求,要求我们实现此功能:商品成交时发送短信,下面小编贴出核心代码,方面大家以后学习. html代码省略..... Model代码省略..... 核心代码如下所示: /* * ------------------------------------------------- * 修改状态 public * Author: lzp Time:-- * ------------------------------------------------- */ public fu

  • php版阿里大于(阿里大鱼)短信发送实例详解

    本文实例讲述了php版阿里大于(阿里大鱼)短信发送实现方法.分享给大家供大家参考,具体如下: 通用函数 // 发送大于短信 更牛逼的 protected function sendDayuSmsPlus($tel,$type,$data) { $dayu_template = 'dayu_template_'.$type; $signname = C($dayu_template.".signname"); $templatecode = C($dayu_template."

  • 使用PHP免费发送定时短信的实例

    由于飞信目前没有开发平台,现有API都是第三方开发,貌似是通过破解WAP飞信或者3G飞信,模拟浏览器的行为来发短信.另外Google code上有开源的php飞信发送类php-fetion.这些飞信接口方便了定时短信的开发. 背景:老妈年纪大了,文化程度不高,但是需要每天了解天气信息才能下地工作,也就无法通过网络获取天气,只能通过电视.于是寻思着自己抓取网络上的天气信息,通过手机短信发送给老妈. 问题:自己不可能每天定时给老妈发送天气短信,现有的天气预报订阅短信又是要钱的. 解决: 免费发送短信

  • PHP通过串口实现发送短信

    随技术进步,短信收发领域按时间先后产生了三种模式:BLOCK MODE,基于AT指令的TEXT MODE,基于AT指令的PDU MODE.其中,TEXT MODE比较简单,多款诺基亚手机均支持此款模式.西门子的手机大多数只支持PDU MODE.PDU 模式是收发短信的一种方法,短信正文经过十六进制编码后被传送.目前,PDU已取代BLOCK MODE. SMS是由Etsi所制定的一个规范(GSM 03.40 和GSM 03.38).当使用7-bits编码时,它可以发送最多160个字符;但用8-bi

  • php发送短信验证码完成注册功能

    短信验证码注册,很简单,用的是  云通讯的短信系统(收费的,不过有测试的api给我们做测试).好了,不多说,进入正题. 1.收到到云通讯短信系统注册账号,然后下载他们的封装好的短信api接口代码,解压,然后找到CCPRestSDK.php文件和SendTemplateSMS.php文件,将其拉到根目录文件夹里. 2.打开SendTemplateSMS.php文件,首先注意include_once('./CCPRestSDK.php'),千万别包含错路径了,将云通讯给的测试主账号,主账号Token

  • php天翼开放平台短信发送接口实现方法

    本文实例讲述了php天翼开放平台短信发送接口实现方法.分享给大家供大家参考.具体分析如下: 临时性需求,研究了一下天翼开发平台的东西,用来发送验证码还是不错的,但是每日限额不多,所以很鸡肋,但是保证100%到达 买的话还是蛮贵的,代码没有做任何优化处理,只是测试是否可以实现接口,用的同学记得完善代码,刚写完老大又说是鸡肋的东西,不用了,代码放在博客记录下,代码如下: 复制代码 代码如下: <?php // date_default_timezone_set('PRC'); //获取access_

  • PHP发送短信代码分享

    方法一(比较好,推荐) //PHP发送短信 Monxin专用(PHP代码函数) //本代码基于Monxin 运行 //代码来源:Monxin ./config/functions.php function sms($config,$language,$pdo,$sender,$phone_number,$content){ //demo var_dump(sms(self::$config,self::$language,$pdo,"system","18074507509,

  • 通过ICQ网关发送手机短信的PHP源程序

    通过ICQ网关发送手机短信的PHP源程序(转自linuxforum.net 原作者:liushiliang EMAIL:  lsl@163.net ) <?//###########################################################//// For questions and comments// Roland (alias -=: Vlieg :=-)// icq #78354631// mail: vlieg@atoomnet.net//// N

  • php实现短信发送代码

    卓望的短信发送.PHP格式.都要不习惯用xml传输数据格式了 标签: <无> 1. [代码][PHP]代码 <?php class Sms { private $userId = 'XXXXX'; private $password = 'XXXXXX'; private $templateId = 'XXXXXX'; /** * @var string 短信服务器地址 */ private $server_uri = 'XXXXXX'; private $port = 'XXXXXX'

随机推荐