rendered paste bodyfunction sendToHost( $host, $port, $method, $path, $data, $referer = '', $useragent = ''){ // Supply a default method of GET if the one passed was empty if (empty($method)) { $method = 'GET'; } $method = strtoupper($method); $fp = fsockopen($host, $port); if ($method == 'GET') { $path .= '?' . $data; } fputs($fp, "$method $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: " . strlen($data) . "\r\n"); if ( $referer != '' ) { fputs($fp, "Referer: $referer\r\n"); } if ( $useragent != '' ) { fputs($fp, "User-Agent: MSIE\r\n"); } fputs($fp, "Connection: close\r\n\r\n"); if ( $method == 'POST' ) { fputs($fp, $data); } $buf = ''; while (!feof($fp)) { $buf .= fgets($fp,128); } fclose($fp); return $buf;} // end of 'sendToHost()'