note 6310 deleted from fsockopen by torben

From: Date: Sat, 19 Aug 2000 21:02:49 +0000
Subject: note 6310 deleted from fsockopen by torben
Groups: php.notes 
Request: Send a blank email to php-notes+get-2678@lists.php.net to get a copy of this message
This is a repost of the previous message, hopefully in a more readable form. (If only &lt;BR&gt; and &lt;P&gt; are going to be allowed, the comment about using &lt;PRE&gt; should be removed...grumble)<BR> <BR> // Data to pass to the cgi script<BR> $name = 'John Doe';<BR> $email = 'johndoe@domain.com';<BR> $msg = 'Nice site, I love your animated gif collection!';<BR> <BR> // Build the request string<BR> $request = 'name=' . urlencode($name);<BR> $request .= '&email=' . urlencode($email);<BR> $request .= '&msg=' . urlencode($msg);<BR> <BR> // Build the header<BR> $header = "POST /guestbook/add.php3 HTTP/1.0rn";<BR> $header .= "Content-type: application/x-www-form-urlencodedrn";<BR> $header .= "Content-length: " . strlen($request) . "rnrn";<BR> <BR> // Open the connection<BR> $fp = fsockopen('www.domain.com', 80, &$err_num, &$err_msg, 30);<BR> if ($fp)<BR> {<BR> // Send everything<BR> fputs($fp, $header . $request);<BR> // Get the response<BR> while (!feof($fp))<BR> $response .= fgets($fp, 128);<BR> }<BR> <BR> I think a browser would send something similar when submitting a form to a script.

« previous php.notes (#2678) next »