note 35894 deleted from function.fsockopen by aidan

From: Date: Sun, 11 Jul 2004 05:53:45 +0000
Subject: note 35894 deleted from function.fsockopen by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73044@lists.php.net to get a copy of this message
Note Submitter: markus.welsch@suk.de ---- A simple HTTP post request function: function httpPost($host, $path, $referer, $data) { $fp = fsockopen($host, 80); fputs($fp, "POST ".$path." HTTP/1.0\r\n"); fputs($fp, "Host: ".$host."\r\n"); fputs($fh, "Referer: ".$referer."\r\n"); fputs($fp, "Content-type: application/x-www-url-encoded\r\n"); fputs($fp, "Content-length: ".strlen($data)."\r\n"); fputs($fp, "\r\n"); fputs($fp, $data."\r\n"); fputs($fp, "\r\n"); $tmp_headers = ""; while ($str = trim(fgets($fp, 4096))) $tmp_headers .= $str."\n"; $tmp_body = ""; while (!feof($fp)) $tmp_body .= fgets($fp, 4096); fclose($fp); return $tmp_body; }

« previous php.notes (#73044) next »