send bin data by post
| From: | php_list at citiz dot net | Date: | Tue, 10 Oct 2000 02:04:12 +0000 |
| Subject: | send bin data by post | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19285@lists.php.net to get a copy of this message | ||
Hello ,
I use this code to send data to my webserver:
***************************************************
function PostIt($DataStream, $Host, $URL) {
$ContentLength = strlen($DataStream);
$ReqHeader =
"POST $URL HTTP/1.0\n".
"Content-Type: application/x-www-form-urlencoded\n".
"Content-Length: $ContentLength\n\n".
"$DataStream\n";
$socket = fsockopen($Host, 80, &$errno, &$errstr);
if( !$socket ) {
print "$errstr ($errno)<br>\n";
return 0;
}
$idx = 0;
fputs($socket, $ReqHeader);
}
PostIt("Data=$Data", "192.168.0.1","/rtimedata.php");
****************************************************
When $Data is text base, This code can be work good, But I want post
bin base, How to do it?
I use base64encode(), it can work, but data size add 1/3, any good
idea ?
Sorry for my english poor.
--
Best regards,
php