本帖最后由 maker 于 2009-10-12 00:57 编辑
试试下面的,没有测试,你自己测试一下,和你的思路不一样不是取表单
不好意思,刚才有个地方没设置好,也是关键的收尾没做好
关键说明:“---------------------------7d92133aec068e”是传送数据开头标志,结尾则是“-----------------------------7d82711db0bfc--”,注意多2个-,我忘了加了,当然,里面的标志字符你可以自己更改,但是文件头别忘了统一Global $nRegCreatePng
RegCreatePng()
$file = FileOpen("log.txt", 0)
$chars = '---------------------------7d92133aec068e' & @CRLF
$chars &= 'Content-Disposition: form-data; name="Tempupload"; filename="log.txt"' & @CRLF
$chars &= 'Content-Type: audio/mpeg' & @CRLF
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
While 1
$chars &= FileReadLine($file) & @CRLF
If @error = -1 Then ExitLoop
WEnd
FileClose($file)
$chars &= '-----------------------------7d82711db0bfc--' & @CRLF
;$chars = StringToBinary($chars)
$oHTTP = ObjCreate("Msxml2.xmlhttp")
$oHTTP.Open("Post", "http://www.maxxp.com.cn/sound.asp?ProgressID=" & $nRegCreatePng, False)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type", "multipart/form-data; boundary=-------------------------7d92133aec068e")
$oHTTP.setRequestHeader("Referer", "http://www.maxxp.com.cn/sound.htm")
$oHTTP.Send($chars)
MsgBox(0, $oHTTP.status, $oHTTP.responseText)
;以下是使用JavScript代码调用
Func RegCreatePng()
Local $code
$code &= 'function regcreatepng()' & @CRLF
$code &= '{' & @CRLF
$code &= 'var now = new Date()' & @CRLF
$code &= 'var nvalue = now.getTime()%1000000000' & @CRLF
$code &= 'return nvalue' & @CRLF
$code &= '}' & @CRLF
$nJS = ObjCreate("ScriptControl")
$nJS.language = "JavaScript"
$nJS.addcode($code)
$nRegCreatePng = $nJS.Run("regcreatepng")
Return $nRegCreatePng
EndFunc ;==>RegCreatePng
|