xml = ( <?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><commonUtil xmlns="http://wtp"><value xmlns:SOAPSDK4="http://wtp">data</value></commonUtil></SOAP-ENV:Body> ) ;请求头根据实际需求修改,注意Content-Type。 result := URLDownloadToVar("http://yourwebsite.com", "UTF-8","POST",xml,{"SOAPAction":"""urn:commonUtil""","Content-Type":"text/xml; charset=""UTF-8""","User-Agent":"SOAP Toolkit 3.0","Host":"0.0.0.0","Content-Length":strlen(xml),"Connection":"Keep-Alive","Cache-Control":"no-cache","Pragma":"no-cache"}) MsgBox % result URLDownloadToVar(url, Encoding = "",Method="GET",postData="",headers:=""){ ;网址,编码,请求方式,post数据,请求头 hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1") if Method = GET { Try { ;hObject.SetTimeouts(500,2000,2000,5000) hObject.Open("GET",url) hObject.Send() } catch e return -1 } else if Method = POST { Try { hObject.SetTimeouts(30000,30000,300000,300000) hObject.Open("POST",url,True) if IsObject(headers) { for k,v in headers hObject.SetRequestHeader(k, v) } hObject.Send(postData) hObject.WaitForResponse(-1) } catch e { FileAppend, % "`n" var_dump(e), error.txt return -1 } } if (Encoding && hObject.ResponseBody) { oADO := ComObjCreate("adodb.stream") oADO.Type := 1 oADO.Mode := 3 oADO.Open() oADO.Write(hObject.ResponseBody) oADO.Position := 0 oADO.Type := 2 oADO.Charset := Encoding return oADO.ReadText(), oADO.Close() } return hObject.ResponseText }
62 queries in 2.070 seconds |