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


Posted in PHP onOctober 30, 2013

通过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!"; }
?>
PHP 相关文章推荐
使用 php4 加速 web 传输
Oct 09 PHP
php中设置index.php文件为只读的方法
Feb 06 PHP
CI框架源码阅读,系统常量文件constants.php的配置
Feb 28 PHP
PHP Error与Logging函数的深入理解
Jun 03 PHP
关于PHP模板Smarty的初级使用方法以及心得分享
Jun 21 PHP
解析:php调用MsSQL存储过程使用内置RETVAL获取过程中的return值
Jul 03 PHP
smarty半小时快速上手入门教程
Oct 27 PHP
PHP获取数组长度或某个值出现次数的方法
Feb 11 PHP
PHP中Session可能会引起并发问题
Jun 26 PHP
解析WordPress中控制用户登陆和判断用户登陆的PHP函数
Mar 01 PHP
php实现base64图片上传方式实例代码
Feb 22 PHP
php使用fputcsv实现大数据的导出操作详解
Feb 27 PHP
PHP分页详细讲解(有实例)
Oct 30 #PHP
php预定义变量使用帮助(带实例)
Oct 30 #PHP
调整PHP的性能
Oct 30 #PHP
PHP数据过滤的方法
Oct 30 #PHP
php另类上传图片的方法(PHP用Socket上传图片)
Oct 30 #PHP
使用Curl进行抓取远程内容时url中文编码问题示例探讨
Oct 29 #PHP
is_uploaded_file函数引发的不能上传文件问题
Oct 29 #PHP
You might like
PHP 5.0对象模型深度探索之对象复制
2008/03/27 PHP
提高PHP编程效率的53个要点(经验小结)
2010/09/04 PHP
PHP 登录记住密码实现思路
2013/05/07 PHP
php 输入输出流详解及示例代码
2016/08/25 PHP
浅谈Laravel模板实体转义带来的坑
2019/10/22 PHP
基于JQuery的cookie插件
2010/04/07 Javascript
jquery 查找新建元素代码
2010/07/06 Javascript
JS实现字体选色板实例代码
2013/11/20 Javascript
JS之Date对象和获取系统当前时间详解
2014/01/13 Javascript
JavaScript中的console.time()函数详细介绍
2014/12/29 Javascript
jQuery实现冻结表头的方法
2015/03/09 Javascript
正则表达式优化JSON字符串的技巧
2015/12/24 Javascript
vue多级多选菜单组件开发
2020/09/08 Javascript
jQuery插件HighCharts绘制2D饼图效果示例【附demo源码下载】
2017/03/21 jQuery
jQuery remove()过滤被删除的元素(推荐)
2017/07/18 jQuery
JS原生轮播图的简单实现(推荐)
2017/07/22 Javascript
node.js实现微信JS-API封装接口的示例代码
2017/09/06 Javascript
微信实现自动跳转到用其他浏览器打开指定APP下载
2019/02/15 Javascript
详解js创建对象的几种方法及继承
2019/04/12 Javascript
基于JavaScript实现大文件上传后端代码实例
2020/08/18 Javascript
[02:32]“虐狗”镜头慎点 2016国际邀请赛中国区预选赛现场玩家采访
2016/06/28 DOTA
[02:49:21]2019完美盛典全程录像
2019/12/08 DOTA
学习python可以干什么
2019/02/26 Python
Django框架中间件定义与使用方法案例分析
2019/11/28 Python
Python判断远程服务器上Excel文件是否被人打开的方法
2020/07/13 Python
python如何爬取网页中的文字
2020/07/28 Python
Selenium webdriver添加cookie实现过程详解
2020/08/12 Python
sklearn中的交叉验证的实现(Cross-Validation)
2021/02/22 Python
如何进行有效的自我评价
2013/09/27 职场文书
电子技术专业中专生的自我评价
2013/12/17 职场文书
法律顾问服务方案
2014/05/15 职场文书
django如何自定义manage.py管理命令
2021/04/27 Python
golang 比较浮点数的大小方式
2021/05/02 Golang
浅谈python数据类型及其操作
2021/05/25 Python
Python jiaba库的使用详解
2021/11/23 Python
Python加密与解密模块hashlib与hmac
2022/06/05 Python