1,502
社区成员
发帖
与我相关
我的任务
分享
Set HttpClient = CreateObject("Microsoft.XMLHTTP")
HttpClient.Open "POST", "http://127.0.0.1/test.php", False
HttpClient.setRequestHeader "Content-Type", "text/xml; charset=gb2312"
HttpClient.send "f_name=aaa&f_code=123456"
<?php
//强制浏览器编码
@header('Content-type: text/html;charset=gb2312');
//设置时区
date_default_timezone_set('PRC');
$s_name = trim($_POST['f_name']);
$s_code = $_POST['f_code'];
echo "用户名" . $s_name;
?>
Public Function URLEncode(ByVal strParameter As String) As String
Dim s As String
Dim I As Integer
Dim intValue As Integer
Dim TmpData() As Byte
s = ""
TmpData = StrConv(strParameter, vbFromUnicode)
For I = 0 To UBound(TmpData)
intValue = TmpData(I)
If (intValue >= 48 And intValue <= 57) Or _
(intValue >= 65 And intValue <= 90) Or _
(intValue >= 97 And intValue <= 122) Then
s = s & Chr(intValue)
ElseIf intValue = 32 Then
s = s & "+"
Else
s = s & "%" & Hex(intValue)
End If
Next I
URLEncode = s
End Function
HttpClient.Send "f_name=" & URLEncode("中文") & "&f_code=123456"
HttpClient.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=gb2312"
<?php
//强制浏览器编码
@header('Content-type: text/html;charset=gb2312');
//设置时区
date_default_timezone_set('PRC');
$s_name = trim($_POST['f_name']);
$s_code = $_POST['f_code'];
echo "用户名" . $s_name;
?></body>
</html>