* 使用方法:
* $post_string = "app=requestversion=beta";
* request_by_other('url',$post_string);
*/
function request_by_other($remote_server, $post_string)
{
$context = array(
'http' = array(
'method' = 'POST',
'header' = 'Content-type: application/x-www-form-urlencoded' .
'\r\n'.'User-Agent : Jimmy\'s POST Example beta' .
'content' = 'mypost=' . $post_string)
);
$stream_context = stream_context_create($context);
一般是直接提供资源的链接,他们使用即可.
把二进制字符串先转为byte[] ,接收后再转回来 byte[] msg = Encoding.Default.GetBytes(你的二进制字符串); socket发送 socket接收byte[] string 你的二进制字符串
可以的.
可以用一个十进制二进制的函数decbin(),生成的是一个字符串,直接输出即可
$content?=?$_POST['data'];
$fp?=?fopen('/tmp/newfile.bin','w');
fwrite($fp,$content);
以上例子是在data参数上传二进制,并保存到/tmp/newfile.bin中,解析json用json_decode,然后把二进制的那个值赋给content就可以