赛迪网 >> 技术应用子站 >> PHP
利用ICQ网关发送手机短信的PHP源程序
作者: 来源:plwww 发布时间:2006.08.04
【Java专区】 【网络安全】 【网管专区】 【linux专区】 【数据库专区】 【进入论坛】 【IT博客】 
【Eclipse】  【PHP】  【DB2】  【Ajax】  【Struts】  【Spring】 

<?

//###########################################################

//

// For questions and comments

// Roland (alias -=: Vlieg :=-)

// icq #78354631

// mail: vlieg@atoomnet.net

//

// NB: This script wont 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="27"; //sms prefix

$phonenumber="0000000"; //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...0.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!";

}

?>

最全面的台式机导购资讯,形成全方位的台式机导购平台
评论】 【推荐】 【 】 【打印】 【关闭
*姓  名: 更多资料 了解方案 认识厂商
*单位名称:
*联系电话:
*电子邮件:
    
◆ 相关文章
· 求一个可移植性强一点的分页程序!!!!!!!!!!!! 2005-10-04
· cqlctpl php模板开始提供,最好用,功能最强大的模板 2004-11-15
· 能自动生成excel格式文件吗 2005-04-24
· 这个字符串转换类用处大吗? 2003-07-22
· 汉字转化为拼音(php版) 2004-08-01