Version: 1.0

Type: Function

Category: HTTP

License: GNU General Public License

Description: A function that sends an ICQ message to specified UIN thru www.icq.com web interface.



<?php

/***********

 Original code by: Tomas Pokorny 
 Modified & posted by: Michal Taborsky <whizz@centrum.cz>

 This function sends an ICQ message. Uses www.icq.com web interface.
 
 Parameters:
  $to - ICQ UIN of recipient
	$name - name of sender
  $email - sender email
	$subject - message subject
	$body - message body

 Example:

  SendICQ(12345678,"WHiZZ","whizz@centrum.cz","Greeting","Hey, it works !");

	 
*/
	
function SendICQ($to,$name,$email,$subject,$body) {
  $variables = "from=".RawURLEncode($name)."&fromemail=".RawURLEncode($email)."&subject=".RawURLEncode($subject)."&body=".RawURLEncode($body)."&to=$to&Send=Send+Message";
  $request =
"POST http://wwp.icq.com/scripts/WWPMsg.dll HTTP/1.0
Referer: http://wwp.icq.com/$to
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.17 i686)
Host: wwp.icq.com
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
Content-type: application/x-www-form-urlencoded
Content-length: ".strlen($variables)."

$variables";

    if ($fs = fsockopen("wwp.icq.com",80)) {
        fputs($fs, $request);
      fclose($fs);
    } else echo "Error while connecting.";
}

?>