通过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 相关文章推荐
Win2000+Apache+MySql+PHP4+PERL安装使用小结
Oct 09 PHP
PHP下几种删除目录的方法总结
Aug 19 PHP
php+memcache实现的网站在线人数统计代码
Jul 04 PHP
常用PHP框架功能对照表
Oct 23 PHP
php中数据库连接方式pdo和mysqli对比分析
Feb 25 PHP
php将数组转换成csv格式文件输出的方法
Mar 14 PHP
简介PHP的Yii框架中缓存的一些高级用法
Mar 29 PHP
PHP 数组基本操作方法详解
Jun 17 PHP
Yii2主题(Theme)用法详解
Jul 23 PHP
全面解析PHP面向对象的三大特征
Jun 10 PHP
PHP日志LOG类定义与用法示例
Sep 06 PHP
aec加密 php_php aes加密解密类(兼容php5、php7)
Mar 14 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入门的学习方法
2007/01/02 PHP
php中替换字符串中的空格为逗号','的方法
2014/06/09 PHP
PHP实现的分解质因数操作示例
2018/08/01 PHP
PHP7内核之Reference详解
2019/03/14 PHP
js检测客户端不是firefox则提示下载
2007/04/07 Javascript
jQuery 获取对象 根据属性、内容匹配, 还有表单元素匹配
2010/05/31 Javascript
Jquery实现页面加载时弹出对话框代码
2013/04/19 Javascript
jQuery读取和设定KindEditor值的方法
2013/11/22 Javascript
js 判断浏览器使用的语言示例代码
2014/03/22 Javascript
js动态添加onclick事件可传参数与不传参数
2014/07/29 Javascript
jQuery中replaceWith()方法用法实例
2014/12/25 Javascript
jQuery实现点击后标记当前菜单位置(背景高亮菜单)效果
2015/08/22 Javascript
JS实现Fisheye效果动感放大菜单代码
2015/10/21 Javascript
JQuery实现的按钮倒计时效果
2015/12/23 Javascript
IE8 内存泄露(内存一直增长 )的原因及解决办法
2016/04/06 Javascript
AngularJS中关于ng-class指令的几种实现方式详解
2016/09/17 Javascript
jquery文字填写自动高度的实现方法
2016/11/07 Javascript
JS给按钮添加跳转功能类似a标签
2017/05/30 Javascript
JavaScript实现简单图片轮播效果
2017/08/21 Javascript
JavaScript正则表达式验证登录实例
2020/03/18 Javascript
Python发送http请求解析返回json的实例
2018/03/26 Python
Python判断中文字符串是否相等的实例
2018/07/06 Python
numpy ndarray 取出满足特定条件的某些行实例
2019/12/05 Python
python 字典item与iteritems的区别详解
2020/04/25 Python
HTML5开发动态音频图的实现
2020/07/02 HTML / CSS
如何查找和删除数据库中的重复数据
2014/11/05 面试题
计算机专业毕业生的自我评价
2013/11/18 职场文书
个人查摆剖析材料
2014/02/04 职场文书
竞选宣传委员演讲稿
2014/05/24 职场文书
安全责任书范文
2014/08/25 职场文书
党性锻炼的心得体会
2014/09/03 职场文书
老公给老婆的检讨书(精华篇)
2014/10/18 职场文书
街道务虚会发言材料
2014/10/20 职场文书
机关单位工作失职检讨书
2014/11/20 职场文书
python通过函数名调用函数的几种方法总结
2021/06/07 Python
低版本Druid连接池+MySQL驱动8.0导致线程阻塞、性能受限
2021/07/01 MySQL