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


Posted in PHP onOctober 09, 2006

通过ICQ网关发送手机短信的PHP源程序
(转自linuxforum.net 原作者:liushiliang EMAIL:  lsl@163.net )

<?
//###########################################################
//
// 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!"; }
?>

PHP 相关文章推荐
php Static关键字实用方法
Jun 04 PHP
浅析Mysql 数据回滚错误的解决方法
Aug 05 PHP
PHP函数之日期时间函数date()使用详解
Sep 09 PHP
php获取参数的几种方法总结
Feb 18 PHP
PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
Aug 28 PHP
php从csv文件读取数据并输出到网页的方法
Mar 14 PHP
深入浅析PHP7.0新特征(五大新特征)
Oct 29 PHP
zend框架实现支持sql server的操作方法
Dec 08 PHP
PHP网站自动化配置的实现方法(必看)
May 27 PHP
phpcms实现验证码替换及phpcms实现全站搜索功能教程详解
Dec 13 PHP
TP5.0框架实现无限极回复功能的方法分析
May 04 PHP
Thinkphp 3.2框架使用Redis的方法详解
Oct 24 PHP
搜索引擎技术核心揭密
Oct 09 #PHP
输出控制类
Oct 09 #PHP
提取HTML标签
Oct 09 #PHP
如何把PHP转成EXE文件
Oct 09 #PHP
一个查看session内容的函数
Oct 09 #PHP
一个显示天气预报的程序
Oct 09 #PHP
web方式ftp
Oct 09 #PHP
You might like
PHP网站提速三大“软”招
2006/10/09 PHP
php+ajax做仿百度搜索下拉自动提示框(有实例)
2012/08/21 PHP
php制作unicode解码工具(unicode编码转换器)代码分享
2013/12/24 PHP
配置eAccelerator和XCache扩展来加速PHP程序的执行
2015/12/22 PHP
YII中Ueditor富文本编辑器文件和图片上传的配置图文教程
2017/03/15 PHP
Laravel框架查询构造器简单示例
2019/05/08 PHP
jQuery 开天辟地入门篇一
2009/12/09 Javascript
JavaScript使用HTML5的window.postMessage实现跨域通信例子
2014/04/11 Javascript
JavaScript使用function定义对象并调用的方法
2015/03/23 Javascript
jQuery聚合函数实例
2015/05/21 Javascript
javascript的理解及经典案例分析
2016/05/20 Javascript
JS动态给对象添加属性和值的实现方法
2016/10/21 Javascript
Vue.js第一天学习笔记(数据的双向绑定、常用指令)
2016/12/01 Javascript
vue.js源代码core scedule.js学习笔记
2017/07/03 Javascript
详解如何使用webpack+es6开发angular1.x
2017/08/16 Javascript
JS实现DOM节点插入操作之子节点与兄弟节点插入操作示例
2018/07/30 Javascript
vue-cli3 项目从搭建优化到docker部署的方法
2019/01/28 Javascript
javascript实现随机抽奖功能
2020/12/30 Javascript
[14:51]DOTA2 HEROS教学视频教你分分钟做大人-卓尔游侠
2014/06/13 DOTA
Django框架模型简单介绍与使用分析
2019/07/18 Python
django ManyToManyField多对多关系的实例详解
2019/08/09 Python
python实发邮件实例详解
2019/11/11 Python
解决Python列表字符不区分大小写的问题
2019/12/19 Python
python 中的[:-1]和[::-1]的具体使用
2020/02/13 Python
jupyter notebook清除输出方式
2020/04/10 Python
Python实现播放和录制声音的功能
2020/08/12 Python
五种Python转义表示法
2020/11/27 Python
使用numpngw和matplotlib生成png动画的示例代码
2021/01/24 Python
汽车技术服务英文求职信范文
2014/01/02 职场文书
二年级小学生评语
2014/04/21 职场文书
大专毕业生求职信
2014/07/05 职场文书
2014年班组建设工作总结
2014/12/01 职场文书
2016年全国爱眼日宣传教育活动总结
2016/04/05 职场文书
MySQL修改默认引擎和字符集详情
2021/09/25 MySQL
win11高清晰音频管理器在哪里?win11找不到高清晰音频管理器解决办法
2022/04/08 数码科技
MySQL外键约束(Foreign Key)案例详解
2022/06/28 MySQL