没用过这方面的,初学,大家帮忙,也可以推荐些这方面的书,thanks!向https, post xml文件
该段函数报错,,,任意采用其它方法都成只要实现向https(ssL) 传xml文件
看是不是有问题function TForm1.FetchWithWinHttpRequest(var xml: string): Integer;const url = 'https://b2bportalprevie…………………………';const proxyServer = 'proxyname:80';const proxyBypass = '127.0.0.1';// HttpRequest SetCredentials flags.const HTTPREQUEST_PROXYSETTING_DEFAULT = 0;const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0;const HTTPREQUEST_PROXYSETTING_DIRECT = 1;const HTTPREQUEST_PROXYSETTING_PROXY = 2; var WinHttpRequest: OLEVariant; errorCode: Integer; //sstatus: string;begin// Initially set the return value of the function to 0 Result := 0; //XML := '<QDS_Data></QDS_Data>'; try// Create the WinHttpRequest COM object WinHttpRequest := CreateOLEObject('WinHttp.WinHttpRequest.5.1'); 运行到这行报错,该参数—--无效字符串// Set proxy server and bypass list errorCode := WinHttpRequest.setProxy(HTTPREQUEST_PROXYSETTING_PROXY, proxyServer, proxyBypass);// Set timeouts WinHttpRequest.setTimeouts(10000, 10000, 10000, 10000); //WinHttpRequest.Option[WinHttpRequestOption_SslErrorIgnoreFlags := 13056]; WinHttpRequest.Open('POST', url, False); WinHttpRequest.SetRequestHeader('Content-Type', 'text/xml'); WinHttpRequest.SetRequestHeader('Content-Length', Length(xml)); WinHttpRequest.SetCredentials(user, passw, 0); errorCode := WinHttpRequest.send(xml); if errorCode = S_OK then begin Result := WinHttpRequest.status; end except on E: Exception do begin Result := -1 end; end;end;
该段函数报错,,,任意采用其它方法都成只要实现向https(ssL) 传xml文件
看是不是有问题function TForm1.FetchWithWinHttpRequest(var xml: string): Integer;const url = 'https://b2bportalprevie…………………………';const proxyServer = 'proxyname:80';const proxyBypass = '127.0.0.1';// HttpRequest SetCredentials flags.const HTTPREQUEST_PROXYSETTING_DEFAULT = 0;const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0;const HTTPREQUEST_PROXYSETTING_DIRECT = 1;const HTTPREQUEST_PROXYSETTING_PROXY = 2; var WinHttpRequest: OLEVariant; errorCode: Integer; //sstatus: string;begin// Initially set the return value of the function to 0 Result := 0; //XML := '<QDS_Data></QDS_Data>'; try// Create the WinHttpRequest COM object WinHttpRequest := CreateOLEObject('WinHttp.WinHttpRequest.5.1'); 运行到这行报错,该参数—--无效字符串// Set proxy server and bypass list errorCode := WinHttpRequest.setProxy(HTTPREQUEST_PROXYSETTING_PROXY, proxyServer, proxyBypass);// Set timeouts WinHttpRequest.setTimeouts(10000, 10000, 10000, 10000); //WinHttpRequest.Option[WinHttpRequestOption_SslErrorIgnoreFlags := 13056]; WinHttpRequest.Open('POST', url, False); WinHttpRequest.SetRequestHeader('Content-Type', 'text/xml'); WinHttpRequest.SetRequestHeader('Content-Length', Length(xml)); WinHttpRequest.SetCredentials(user, passw, 0); errorCode := WinHttpRequest.send(xml); if errorCode = S_OK then begin Result := WinHttpRequest.status; end except on E: Exception do begin Result := -1 end; end;end;
Response:=TStringStream.Create('');
try
logininfo.Add('username=111');
logininfo.Add('password=222');
logininfo.Add('submit=登录');
IdHTTP1.Post('http://bbs.96980.net/member.php',logininfo,Response);
LY独家提供最新版本OpenSSL for Indy