通过ICQ网关发送手机短信的PHP源程序

林继 PHP 技术 3,696 共写了123个字 (2009-01-05 0:10:52) 没有评论 打印 扫描二维码 百度已收录

这些代码是不起作用的,只是作为参考而已。

通过ICQ网关发送手机短信的PHP源程序
   (转自linuxforum.net 原作者:liushiliang EMAIL:  lsl@163.net )

  1.    <? 
  2.    //########################################################### 
  3.    // 
  4.    // For questions and comments 
  5.    // Roland (alias -=: Vlieg :=-) 
  6.    // icq #78354631 
  7.    // mail: vlieg@atoomnet.net 
  8.    // 
  9.    // 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 
  10.    //########################################################### 
  11.     
  12.     
  13.    //****************************************************************//Config: 
  14.     
  15.    $uin=""; //your ICQ number 
  16.    $passw=""; //your ICQpassword 
  17.     
  18.    $prefix=""; //sms prefix 
  19.    $phonenumber=""; //sms phone number 
  20.    $message = "Hello!"; //sms message    
  21.    //****************************************************************// EN: calculate the content length 
  22.     
  23.    $contentlength= ( 37+ 
  24.    strlen($uin)+ 
  25.    strlen($passw) 
  26.    ); 
  27.     
  28.    //****************************************************************// Openen van de inlogpagina 
  29.    // EN: open loginpage 
  30.     
  31.    $htmlreply=""; 
  32.    $post ="POST http://web.icq.com/karma/dologin/1,,,00.html HTTP/1.0 
  33.    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* 
  34.    Referer: http://web.icq.com/sms/login/1,,,00.html 
  35.    Accept-Language: nl 
  36.    Content-Type: application/x-www-form-urlencoded 
  37.    Accept-Encoding: gzip, deflate 
  38.    User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) 
  39.    Host: web.icq.com 
  40.    Content-Length: ".$contentlength." 
  41.    Proxy-Connection: Keep-Alive 
  42.    Pragma: no-cache 
  43.    Cookie: uin=".$uin."; sms_country=".$prefix."; KarmaService1=Yes; uin=".$uin."; sms_country=".$prefix."; KarmaService1=Yes  
  44.     
  45.    uService=1&uLogin=".$uin."&uPassword=".$passw."&x=0&y=0"; 
  46.     
  47.    $remote = fsockopen("web.icq.com", 80, &$errno, &$errstr, 30); 
  48.     
  49.    global $remote; 
  50.    global $post; 
  51.    fputs($remote, $post); 
  52.     
  53.    while (!feof($remote)) { $htmlreply.=fgets($remote,120); } 
  54.    //UNCOMMENT FOR OUTPUT: echo "".htmlspecialchars($htmlreply).""; 
  55.    fclose($remote); 
  56.     
  57.    //**************************************************************** 
  58.        //persoonlijke cookie uit de inlogpage halen 
  59.    // EN: fetch personal cookie from login page 
  60.     
  61.    $splited = split(" ",$htmlreply); 
  62.    $cookies = $splited[3]; 
  63.    $cookies = str_replace("Set-Cookie: KarmaLogin=","",$cookies); 
  64.    $cookies = str_replace("; path=/","",$cookies); 
  65.    $cookies = str_replace(" ","",$cookies); 
  66.    //UNCOMMENT VOOR OUTPUT: echo $cookies; 
  67.     
  68.    if (strlen($prefix) == 2) { $contentprefix = ' '.$prefix; } else { $contentprefix = $prefix; } 
  69.    $charcount = (160-strlen($message)); 
  70.    $contentlength= ( 1561+ 
  71.    strlen($message)+ 
  72.    strlen($charcount)+ 
  73.    strlen($phonenumber)+ 
  74.    strlen($prefix) 
  75.    ); 
  76.     
  77.    //**************************************************************** 
  78.       //Verzendpagina openen met de opgehaalde cookie 
  79.   // EN: open send page with fetched cookie 
  80.     
  81.    $htmlreply=""; 
  82.    $post ='POST http://web.icq.com/sms/send_history/1,,,00.html HTTP/1.0 
  83.    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint,application/vnd.ms-excel, application/msword, 
  84.    Referer: http://web.icq.com/sms/send_session/1,,,00.html?prefix=+'.$prefix.'&carrier=&tophone='.$phonenumber.'  
  85.    Accept-Language: nl 
  86.    Content-Type: multipart/form-data; boundary=---------------------------7d12442eab4 
  87.    Accept-Encoding: gzip, deflate 
  88.    User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) 
  89.    Host: web.icq.com 
  90.    Content-Length: '.$contentlength.' 
  91.    Proxy-Connection: Keep-Alive 
  92.    Pragma: no-cache 
  93.    Cookie: uin='.$uin.'; sms_country='.$prefix.'; KarmaService1=Yes; KarmaLogin='.$cookies.'; uin='.$uin.'; sms_country='.$prefix.'; KarmaService1=Yes; KarmaLogin='.$cookies.'  
  94.     
  95.    -----------------------------7d12442eab4 
  96.    Content-Disposition: form-data; name="carrier" 
  97.     
  98.     
  99.    -----------------------------7d12442eab4 
  100.    Content-Disposition: form-data; name="prefix" 
  101.     
  102.    '.$contentprefix.' 
  103.    -----------------------------7d12442eab4 
  104.    Content-Disposition: form-data; name="tophone" 
  105.     
  106.    '.$phonenumber.' 
  107.    -----------------------------7d12442eab4 
  108.    Content-Disposition: form-data; name="uSession" 
  109.     
  110.    1 
  111.    -----------------------------7d12442eab4 
  112.    Content-Disposition: form-data; name="uReply" 
  113.     
  114.     
  115.    -----------------------------7d12442eab4 
  116.    Content-Disposition: form-data; name="uLastId" 
  117.     
  118.     
  119.    -----------------------------7d12442eab4 
  120.    Content-Disposition: form-data; name="uSend" 
  121.     
  122.    1 
  123.    -----------------------------7d12442eab4 
  124.    Content-Disposition: form-data; name="uNextId" 
  125.     
  126.     
  127.    -----------------------------7d12442eab4 
  128.    Content-Disposition: form-data; name="uHistoryCounter" 
  129.     
  130.    1 
  131.    -----------------------------7d12442eab4 
  132.    Content-Disposition: form-data; name="count" 
  133.     
  134.    0 
  135.    -----------------------------7d12442eab4 
  136.    Content-Disposition: form-data; name="uSubmitCount" 
  137.     
  138.    0 
  139.    -----------------------------7d12442eab4 
  140.    Content-Disposition: form-data; name="checkNewMsg" 
  141.     
  142.    180000 
  143.    -----------------------------7d12442eab4 
  144.    Content-Disposition: form-data; name="charcount" 
  145.     
  146.    '.$charcount.' 
  147.    -----------------------------7d12442eab4 
  148.    Content-Disposition: form-data; name="msg" 
  149.     
  150.    '.$message.' 
  151.    -----------------------------7d12442eab4 
  152.    Content-Disposition: form-data; name="x" 
  153.     
  154.    30 
  155.    -----------------------------7d12442eab4 
  156.    Content-Disposition: form-data; name="y" 
  157.     
  158.    16 
  159.    -----------------------------7d12442eab4-- 
  160.    '; 
  161.     
  162.    $remote = fsockopen("web.icq.com", 80, &$errno, &$errstr, 30); 
  163.     
  164.    global $remote; 
  165.    global $post; 
  166.    fputs($remote, $post); 
  167.     
  168.    while (!feof($remote)) { $htmlreply.=fgets($remote,120); } 
  169.    //UNCOMMENT FOR OUTPUT: echo "".htmlspecialchars($htmlreply).""; 
  170.    fclose($remote); 
  171.     
  172.    //**************************************************************** 
  173.       // check if message is send if send 'moved permanently' is returned 
  174.     
  175.    if (eregi('Moved Permanently',$htmlreply)) 
  176.    { echo "Sms message successfully sent!"; } 
  177.    else 
  178.    { echo "Sms not sent!"; } 
  179.    ?>

历史上的今天

1月
5

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

< >