note 40479 added to function.fsockopen

From: Date: Thu, 04 Mar 2004 22:11:42 +0000
Subject: note 40479 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-66277@lists.php.net to get a copy of this message
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); ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40479 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40479&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40479&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66277) next »