Indy的IdTCPClient等组件,代理服务器只支持Socks4、Socks5协议,但现在很多公司只支持HTTP代理协议
哪位DX知道解决方法?http://community.csdn.net/Expert/topic/4864/4864910.xml?temp=.1187403
这个贴子里提了很久,没人能解决。
哪位DX知道解决方法?http://community.csdn.net/Expert/topic/4864/4864910.xml?temp=.1187403
这个贴子里提了很久,没人能解决。
今天查了些资料,帮你搞店
procedure TForm1.Button1Click(Sender: TObject);
var
repl: TIdRFCReply; //需要uses IdRFCReply;
s, s1: String;
begin
//本机上装了superproxy软件,http代理端口为8090
IdTCPClient1.Port:= 8090;
IdTCPClient1.Host:= '127.0.0.1';
IdTcpClient1.Connect();
IdTCPClient1.SendCmd('CONNECT 127.0.0.1:8090 HTTP/1.0'#13#10#13#10);
repl:= IdTCPClient1.LastCmdResult;
if repl.ReplyExists then
begin
Memo1.Lines.AddStrings(repl.Text);
if (Pos('200', repl.Text[0])>0) then
begin
//代理服务器连接成功,发送http get请求
IdTCPClient1.SendCmd('GET http://www.zgzcw.com/ HTTP/1.0'#13#10+
'Accept: text/html,text/plain;q=0.7,image/png,image/jpeg,image/gif;q=0.4,*/*;q=0.6'#13#10+
'User-Agent: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'#13#10+
'Host: www.zgzcw.com'#13#10+
'Proxy-Connection: close'#13#10#13#10);
s:='';
while(True) do
begin
sleep(100);//等待数据接收期间,休息
s1:= IdTCPClient1.CurrentReadBuffer;
if Length(s1)=0 then
break //已到数据尾部
else
s:= s+s1;
end;
Memo1.Lines.Add(s);
end;
end;
IdTCPClient1.Disconnect;
end;