Board index » delphi » Indy 10 post hyperlink issue
Caigangshan
Delphi Developer |
Indy 10 post hyperlink issue2008-06-14 10:11:27 PM delphi105 I use the following code to post some data: procedure Test(name, id: string); var content: string; i, count, npos: Integer; LoginData: TStringList; idHTTP: TIdHTTP; begin idHTTP := TIdHTTP.Create(nil); LoginData := TStringList.Create; try idHTTP.Request.Accept := '*/*'; idHTTP.Request.AcceptLanguage := 'zh-cn' ; idHTTP.Request.ContentType := 'application/x-www-form- urlencoded'; idHTTP.Request.AcceptEncoding := 'gzip, deflate' ; idHTTP.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; WPS; QQDownload 1.7; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; ' ; idHTTP.Request.Host := 'www.test.com'; idHTTP.Request.Connection := 'Keep-Alive'; idHTTP.Request.CacheControl := 'no-cache'; content := '<a href="www.test.com" target="_blank">Test</ a>' LoginData.Add('name=' + name); LoginData.Add('id=' + id); LoginData.Add('content=' + content); idHTTP.Post(CONST_URL, LoginData); finally LoginData.Free; idHTTP.Free; end; end; The code can post the data, but when I browse the hyperlink in IE or Firefox, the hyperlink is showing "<a href="www.test.com" target="_blank">Test</a>" , the html source of the hyperlink is & lt;a href="www.test.com" target="_blank"& gt;Test & lt;/a& gt; but when I post the hyperlink directly in IE, the hyperlink is correct, I use the LoginData.Add('content=' + TIdURI.ParamsEncode(content ) ); but still have the problem, I use HTTPLook to monitor the IE post data and Indy post data, find they the same except for cookie. I have spend some days to resolve this problem. Please help me.... Chris |