关于winhttp udf的
最近发现用 _WinHttpCrackUrl 后面的 $iFlag = Default 会自动把 提交页面 中的url字符转换成 乱码 求解决 或者 让 crackurl的过程中 不处理 iflag的转换$ICU_DECODE - 转换 "escape encoded" 字符(%xx) 为非 escaped 结构.
$ICU_ESCAPE - Escapes 若干字符为它们的转义序列 (%xx).
Func _WinHttpCrackUrl($sURL, $iFlag = Default)
If $iFlag = Default Or $iFlag = -1 Then $iFlag = $ICU_ESCAPE
Local $tURL_COMPONENTS = DllStructCreate("dword StructSize;" & _
"ptr SchemeName;" & _
"dword SchemeNameLength;" & _
"int Scheme;" & _
"ptr HostName;" & _
"dword HostNameLength;" & _
"word Port;" & _
"ptr UserName;" & _
"dword UserNameLength;" & _
"ptr Password;" & _
"dword PasswordLength;" & _
"ptr UrlPath;" & _
"dword UrlPathLength;" & _
"ptr ExtraInfo;" & _
"dword ExtraInfoLength")
DllStructSetData($tURL_COMPONENTS, 1, DllStructGetSize($tURL_COMPONENTS))
Local $tBuffers
Local $iURLLen = StringLen($sURL)
For $i = 0 To 5
$tBuffers[$i] = DllStructCreate("wchar[" & $iURLLen + 1 & "]")
Next
DllStructSetData($tURL_COMPONENTS, "SchemeNameLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "SchemeName", DllStructGetPtr($tBuffers))
DllStructSetData($tURL_COMPONENTS, "HostNameLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "HostName", DllStructGetPtr($tBuffers))
DllStructSetData($tURL_COMPONENTS, "UserNameLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "UserName", DllStructGetPtr($tBuffers))
DllStructSetData($tURL_COMPONENTS, "PasswordLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "Password", DllStructGetPtr($tBuffers))
DllStructSetData($tURL_COMPONENTS, "UrlPathLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "UrlPath", DllStructGetPtr($tBuffers))
DllStructSetData($tURL_COMPONENTS, "ExtraInfoLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "ExtraInfo", DllStructGetPtr($tBuffers))
Local $aCall = DllCall($hWINHTTPDLL__WINHTTP, "bool", "WinHttpCrackUrl", _
"wstr", $sURL, _
"dword", $iURLLen, _
"dword", $iFlag, _
"ptr", DllStructGetPtr($tURL_COMPONENTS))
If @error Or Not $aCall Then Return SetError(1, 0, 0)
Local $aRet = , 1), _
DllStructGetData($tURL_COMPONENTS, "Scheme"), _
DllStructGetData($tBuffers, 1), _
DllStructGetData($tURL_COMPONENTS, "Port"), _
DllStructGetData($tBuffers, 1), _
DllStructGetData($tBuffers, 1), _
DllStructGetData($tBuffers, 1), _
DllStructGetData($tBuffers, 1)]
Return $aRet
EndFunc ;==>_WinHttpCrackUrl _WinHttpCrackUrl($sURL, $ICU_DECODE) 不行吗? 现在用的就是$ICU_DECODE
viewtype=%E6%9C%AA%E5%88%86%E7%BB%84%E5%A5%BD%E5%8F%8B&start=
变成
viewtype=鏈?垎缁勫ソ鍙?start= dddddddddddddddd 给个网址看看,并且说明下你想干嘛? 我也是同样的问题啊!!!没办法~~~~~ _WinHttpCrackUrl( )$sURL中 有汉字,且超过7个就是不行 人工修改$aUrl = _WinHttpCrackUrl()后的 $aUr 试试不知如何 给个完整的URL测试下 七个汉字的人工修改$aUrl = _WinHttpCrackUrl()后的 $aUr 成功。 我直接倒回去了 直接用汉字提交。
页:
[1]