I know that you can get the headers. The problem is not with the headers. They are arriving just fine. The problem is getting the entire Input Stream to check how the body has arrived. The code'd be:
$sk = fsockopen ($server, 80, $errno, $errstr, 30);
if (!$sk) {
echo "$errstr ($errno)<br>\n";
}
else{
$boundary="------------------".md5(uniqid(rand()));
$body="$boundary\r\n";
$body.="Content-Disposition: form-data; name=\"MAX_FILE_SIZE\"\r\n\r\n";
$body.="2000000\r\n"; //just to make sure...
$body.="$boundary\r\n";
$body.="Content-Disposition: form-data; name=\"userfile\"; filename=\"example.html\"\r\n";
$body.="Content-Type: text/html\r\n\r\n";
$body.="<head>example</head>\r\n";
$body.="$boundary--";
$headers="POST http://$server/$RemoteUpPage HTTP/1.0\r\n";
$headers.="Connection: Keep-Alive\r\n";
$headers.="Content-length: ".(strlen($message))."\r\n";
$headers.="Content-type: multipart/form-data; boundary=$boundary\r\n";
$headers.="Host: $server\r\n\r\n";
$headers.=$body;
fputs($sk, $str, strlen($str));
while(!feof($sk)){echo fgets($sk,80);}
fclose($sk);
}
what I get if I write in $RemoteUpPage the following:
while ( list($key, $val) = each($HTTP_POST_FILES['userfile']) ) {
echo "<li>$key : $val\n";
}
would be:
name : example.html
type : text/html
and that's it. No $userfile_name or size (the file is not being uploaded)
Thanks in advance