I
idreamc
Unregistered / Unconfirmed
GUEST, unregistred user!
急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急急! Indy 的 TIdHttp 的 Post 问题,实在想不到办法,求救!全部分数不要嫌少! (25分)<br />当使用IdHttp对没有文件名的URL进行Post请求,总是错误,求解!
FUNCTION Search():BOOL;
VAR s:STRING;
http:TIdHttp;
para:TStringList;
BEGIN
http:=TIdHttp.Create(NIL);
para:=TStringList.Create;
http.AllowCookies:=TRUE;
HTTP.Request.ContentType := 'application/x-www-form-urlencoded';
s:='http://www.google.com/search';
para.Add('q='+'abcdefg');
para.Add('hl=zh-CN');
para.Add('lr=');
para.Add('ie=UTF-8');
para.Add('oe=UTF-8');
TRY sData:=http.Post(s,Para) Except
ON E: Exception DO BEGIN SHowMessage('Error'); END;
END;
para.Free;
http.Free;
END;
FUNCTION Search():BOOL;
VAR s:STRING;
http:TIdHttp;
para:TStringList;
BEGIN
http:=TIdHttp.Create(NIL);
para:=TStringList.Create;
http.AllowCookies:=TRUE;
HTTP.Request.ContentType := 'application/x-www-form-urlencoded';
s:='http://www.google.com/search';
para.Add('q='+'abcdefg');
para.Add('hl=zh-CN');
para.Add('lr=');
para.Add('ie=UTF-8');
para.Add('oe=UTF-8');
TRY sData:=http.Post(s,Para) Except
ON E: Exception DO BEGIN SHowMessage('Error'); END;
END;
para.Free;
http.Free;
END;