Location: PHPKode > scripts > sockclass > sockclass/sockclass.php
* Jik All rights reserved.
* This is a standard copyright header for all source code appearing
* at Jik. This application/class/script may be redistributed,
* as long as the above copyright remains intact. 
* Comments to hide@address.com
************* check new to http://jiks.chat.ru ***************

 * @title Sock Sender
 * @author Jik 
 * @version 0.1 - first version. Supported only POST method
 it's class allow send any POST http query to any server and get answer.
 Use for send from script (and cron) any posts to any servers: icq, sms, boards, and other.

	Open html source code from server, mark a "input" tags, values, write $data array and send it!

class socksender
	var $User_Agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)";
	var $Accept_Encoding="gzip, deflate";
	var $method="POST";
	var $protocol="HTTP/1.0";
	var $send2port=80;

	function send($host, $send2url, $referer, $data)
		while (list($name,$value)=each($data))
		$enc_data=implode("&", $tmp_data);
	if ($this->method=="POST")
			$this->method." ".$send2url." HTTP/1.0\r\n".
			"Referer: ".$referer."\r\n".
			"Content-Type: application/x-www-form-urlencoded"."\r\n".
			"Content-Length: ".$len_data."\r\n".
			"Host: ".$host."\r\n".
			"Accept: */*\r\n".
			"Accept-Encoding: ".$this->Accept_Encoding."\r\n".
			"Connection: Keep-Alive"."\r\n".
			"User-Agent: ".$this->User_Agent."\r\n"."\r\n".
		   $fs = fsockopen($host, $this->send2port, &$errno, &$errstr, 30);
	           if (!$fs) { die ("unable open socket: $errstr ($errno)");}
		   fputs ($fs, $http_query);
		   while($r=fgets ($fs, 20048)) $rt.=$r;
	return $rt;

$post=new socksender();

$data[body]="MESSAGE BODY";

echo "<pre>".$post->send("web.icq.com", "/whitepages/page_me/1,,,00.html", "http://web.icq.com/wwp?Uin=27076181", $data)."</pre>";
Return current item: sockclass