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

 更新时间:2013年10月30日 15:25:49   作者:  
php发送手机短信实例代码。

通过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!"; }
?>

相关文章

  • ThinkPHP中session函数详解

    ThinkPHP中session函数详解

    这篇文章主要为大家详细介绍了ThinkPHP中session函数,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2016-09-09
  • Yii2实现ajax上传图片插件用法

    Yii2实现ajax上传图片插件用法

    这篇文章主要介绍了Yii2实现ajax上传图片插件用法,结合实例形式分析了Yii上传图片插件的具体使用方法,需要的朋友可以参考下
    2016-04-04
  • CVE-2020-15148漏洞分析

    CVE-2020-15148漏洞分析

    这篇文章主要为大家介绍了CVE-2020-15148漏洞分析,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2023-02-02
  • Yii框架中使用PHPExcel的方法分析

    Yii框架中使用PHPExcel的方法分析

    这篇文章主要介绍了Yii框架中使用PHPExcel的方法,简单分析了Yii使用PHPExcel的相关操作技巧与注意事项,并附带说明了Yii的autoload机制,需要的朋友可以参考下
    2019-07-07
  • php 从一个数组中随机的取出若干个不同的数实例

    php 从一个数组中随机的取出若干个不同的数实例

    本文章向码农介绍php从一个不重复的数组中随机的取出若干个不同的元素,难点是防止在取数的时候出现已经取到过的情况(特别是取到最后),需要尽可能的降低碰撞,需要的朋友可以参考下
    2016-12-12
  • 基于php解决json_encode中文UNICODE转码问题

    基于php解决json_encode中文UNICODE转码问题

    这篇文章主要介绍了基于php解决json_encode中文UNICODE转码问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-11-11
  • PHP获取网页标题的3种实现方法代码实例

    PHP获取网页标题的3种实现方法代码实例

    这篇文章主要介绍了PHP获取网页标题的3种实现方法,分别使用CURL、file()函数、file_get_contents实现,需要的朋友可以参考下
    2014-04-04
  • mysql 性能的检查和优化方法

    mysql 性能的检查和优化方法

    mysql在遇到严重性能问题时,一般都有这么几种可能
    2009-06-06
  • Laravel 之url参数,获取路由参数的例子

    Laravel 之url参数,获取路由参数的例子

    今天小编就为大家分享一篇Laravel 之url参数,获取路由参数的例子,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2019-10-10
  • yii2行为的方法如何注入到组件类中详解

    yii2行为的方法如何注入到组件类中详解

    这篇文章主要给大家介绍了关于yii2中行为的方法是如何注入到组件类中去的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧。
    2017-08-08

最新评论