note 40479 deleted from function.fsockopen by nlopess

From: Date: Fri, 05 Mar 2004 18:04:15 +0000
Subject: note 40479 deleted from function.fsockopen by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66313@lists.php.net to get a copy of this message
Note Submitter: max87@gmx.net ---- i was trying to do a POST request with DATA SENDING, nothing seemed to work, no php.net examples no google... well i understood why, do NOT use \r, use \n ARGH!!! i'm using 4.3.4 + apache 1.3.29 on windows XP (my editor uses windows file format style) here is the post request with MINIMUM lines, anything else(like browser, ...) can be added as you wish... $a=fsockopen($host, $urlport, $errno, $errstr, $timeout); ...//some stuff in case of error //------------ $header="POST ".$path." HTTP/1.0"; //e.g. $path="/foo.php" $header.="\n"; $header.="Content-Type: application/x-www-form-urlencoded"; $header.="\n"; $header.="Content-Length: ".strlen($data); $header.="\n"; $header.="\n"; $header.=$data."\r\n"; //e.g. $data = "a=abc" //and yes only here we can use \r\n or \n\n //------------ fwrite ($a, $header); ...//read and do something fclose($a);

« previous php.notes (#66313) next »