php使用ICQ網(wǎng)關(guān)發(fā)送手機短信
通過ICQ網(wǎng)關(guān)發(fā)送手機短信的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!"; }
?>
相關(guān)文章
laravel 操作數(shù)據(jù)庫常用函數(shù)的返回值方法
今天小編就為大家分享一篇laravel 操作數(shù)據(jù)庫常用函數(shù)的返回值方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-10-10發(fā)布一個用PHP fsockopen寫的HTTP下載的類
發(fā)布一個用PHP fsockopen寫的HTTP下載的類...2007-02-02ThinkPHP框架使用redirect實現(xiàn)頁面重定向的方法實例分析
這篇文章主要介紹了ThinkPHP框架使用redirect實現(xiàn)頁面重定向的方法,結(jié)合實例形式分析了thinkPHP中redirect進行頁面重定向的相關(guān)操作技巧與注意事項,需要的朋友可以參考下2018-04-04PHP 構(gòu)造函數(shù)和析構(gòu)函數(shù)原理與用法分析
這篇文章主要介紹了PHP 構(gòu)造函數(shù)和析構(gòu)函數(shù)原理與用法,結(jié)合具體實例形式分析了PHP 構(gòu)造函數(shù)和析構(gòu)函數(shù)基本概念、功能、原理、用法及相關(guān)操作注意事項,需要的朋友可以參考下2020-04-04php+layui數(shù)據(jù)表格實現(xiàn)數(shù)據(jù)分頁渲染代碼
今天小編就為大家分享一篇php+layui數(shù)據(jù)表格實現(xiàn)數(shù)據(jù)分頁渲染代碼,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-10-10php resizeimage 部分jpg文件 生成縮略圖失敗的原因分析及解決辦法
這篇文章主要介紹了php resizeimage 部分jpg文件 生成縮略圖失敗的原因分析及解決辦法的相關(guān)資料,需要的朋友可以參考下2016-03-03PHP register_shutdown_function()函數(shù)的使用示例
這篇文章主要介紹了PHP register_shutdown_function()函數(shù)的使用示例,當我們的腳本執(zhí)行完成或者意外死掉導致 php 執(zhí)行即將關(guān)閉時,register_shutdown_function()這個函數(shù)會被調(diào)用,需要的朋友可以參考下2015-06-06