Another SMS via ICQ script

  • 18 years ago

    Hi all,


    I don't know if you remeber but a while back i posted a script here that sent sms messages to mobiles via the icq network.  Shortly after, however, ICQ changed its protocol and the script stopped working....


    ... well, I'm back .


    but i need your help.  The following is the script which should work, only it falls over at the last server POST request.  Can someone help me figure out what is going wrong, or how the icq server security checks could be.... err... bypassed?


    Code:

    <?
     $login['karmasuccessurl']   = "http://web.icq.com/sms/inbox/?";
     $login['karmafailurl']      = "/login/loginpage?karmaproductcss=icq2go&karmasuccessurl=http%3A%2F%2Fweb%2Eicq%2Ecom%2Fsms%2Finbox%2F%3F&karmaforget=&karmaservice=";
     $login['karma
    service']       = "";
     $login['karmauserlogin']    = "111111111";   // your icq number
     $login['karmauserpasswd']   = "password";   // your icq password
     $login['karma_remember']      = "1";


     / build request string for login /
     foreach ($login as $key=>$val)
       $requestarray[] = "$key=$val";
     $login
    request = "?".implode($request_array, "&");




     // the following details are for mobile number -  +44 (0)7968 330292
     $sms['country']   = "44";       // the receivers country code
     $sms['prefix']    = "+44";      // the receivers country code with + prefix
     $sms['carrier']   = "7968";     // the receivers mobile network number
     $sms['tophone']   = "330292";   // the receivers mobile number
     $sms['uSend']     = "1";
     $sms['msg']       = "this is a test message";     // the message to be sent
     $sms['charcount'] = (160 - strlen($sms['msg']));  // 160 - length of the message


     / build request string for sending sms /
     foreach ($sms as $key=>$val) {
       $smsrequest .= "--6G+f\n"
                      ."Content-Disposition: form-data; name=\"".$key."\"\n\n"
                      .$val."\n";
     }
     $sms
    request .= "--6G+f\n";




     // log user in and get cookies for later use.
     $fp = fsockopen("web.icq.com", 80);
     fputs($fp, "POST http://web.icq.com/newlogin/1,,,00.html HTTP/1.0\n");
     fputs($fp, "Referer: http://web.icq.com/login/loginpage/?karmaproductcss=icq2go&karmaforget=&karmaservice=&karmasuccessurl=http%3A%2F%2Fweb%2Eicq%2Ecom%2Fsms%2Finbox%2F%3F\n");
     fputs($fp, "Connection: close\n");
     fputs($fp, "Content-Type: application/x-www-form-urlencoded\n");
     fputs($fp, "Content-Length: ".strlen($login
    request)."\n\n");
     fputs($fp, $login_request);
     while (!feof($fp)) {
       $return = fgets($fp, 1024);
       // we only want cookies with data in them.
       if (stristr($return, "cookie") && !eregi("karma2_[a-z]+\=\;",$return)) {
         $cookies[] = "Cookie".trim(stristr($return, ":"))."\n";
       }
     }
     fclose($fp);





     // open sms form page and get the cookie which is set on that page
     $fp = fsockopen("web.icq.com", 80);
     fputs($fp, "GET http://web.icq.com/sms/inbox/? HTTP/1.0\n");
     foreach ($cookies as $key=>$val) {
       fputs($fp, $val);
     }
     fputs($fp, "Connection: close\n\n");
     while (!feof($fp)) {
       $return = fgets($fp, 1024);
       // we only want cookies with data in them.
       if (stristr($return, "set-cookie:") && !eregi("karma2_[a-z]+\=\;",$return)) {
         $cookies[] = "Cookie".trim(stristr($return, ":"))."\n";
       }
     }
     fclose($fp);




     // set the cookies that are set by javascript when the form is sent.
     $cookies[] = "Cookie: noalert=false;expires=Saturday, 06-Sep-2014 23:50:08 GMT;path=/;domain=.icq.com;\n";
       $cookies[] = "Cookie: sms
    country=".$sms['country'].";expires=Saturday, 06-Sep-2014 23:50:08 GMT;path=/;domain=.icq.com;\n";



     // send the data to the sms processing script.
     $fp = fsockopen("web.icq.com", 80);
     fputs($fp, "POST http://web.icq.com/sms/sendmsgtx/1,,,00.html HTTP/1.0\n");
     foreach ($cookies as $key=>$val) {
       fputs($fp, $val);
     }
     fputs($fp, "Connection: close\n\n");
     fputs($fp, "Content-Type: multipart/form-data; boundary='6G+f'\n\n");
     fputs($fp, "Content-Length: ".strlen($smsrequest)."\n\n");
     fputs($fp, $sms
    request);
     while (!feof($fp)) {
       $return = fgets($fp, 1024);
       echo $return."<BR>";
     }
     fclose($fp);
    ?>



    ps, if you get the working, please don't rip it off as your own work.  I've have spent many hours slaving over this when i should have been doing university work.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++ : Where friends have access to your private members.” - Gavin Russell Baker