CoXMLHTTP30在哪个单元文件里?oReq := CoXMLHTTP30.Create; 这句为什么老出错? Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiBase/html/delphi_20061206214636252.html
我有一段代码:
procedure TFrmZhGs.cmdUpLoadClick(Sender: TObject);
var
pXML: WideString;
strXML: WideString;
oReq: IXMLHTTPRequest;
reMsg :String;
root: IXMLDOMDocument;
node: IXMLDOMNode;
iLength: Integer;
begin
strXML := txtXML.Text;
If strXML = '' Then
Exit;
addLog('上传数据');
pXML := 'xml=' + strXML;
pXML := URLEncoding(pXML);
try
oReq := CoXMLHTTP30.Create;
oReq.Open('POST', POST_URL + 'zhgs.asp', False,varNull,varNull);
iLength := Length(pXML);
oReq.setRequestHeader('Content-Length', IntToStr(iLength));
oReq.setRequestHeader('CONTENT-TYPE', 'application/x-www-form-urlencoded');
oReq.send(pXML);
end;
oReq := CoXMLHTTP30.Create; 这句老实执行不过去,大虾救救。
自顶。
try
oReq := CoXMLHTTP30.Create;
oReq.Open('POST', POST_URL + 'zhgs.asp', False,varNull,varNull);
iLength := Length(pXML);
oReq.setRequestHeader('Content-Length', IntToStr(iLength));
oReq.setRequestHeader('CONTENT-TYPE', 'application/x-www-form-urlencoded');
oReq.send(pXML);
end;
================================
不是那句执行不过去
而是你try了 后面又没跟进异常保护模块 怎么不会出错
你这样写
oReq := CoXMLHTTP30.Create;
try
oReq.Open('POST', POST_URL + 'zhgs.asp', False,varNull,varNull);
iLength := Length(pXML);
oReq.setRequestHeader('Content-Length', IntToStr(iLength));
oReq.setRequestHeader('CONTENT-TYPE', 'application/x-www-form-urlencoded');
oReq.send(pXML);
finally
oReq.free;
end;
end;