Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function send(method,zap,cooc,params,ref,mime,proxyTYPE,proxy,port,proxyUSER,proxyPASS:string;headerS:array of string):string;
- var Header : TStringList;
- Contents : TStringList;
- httpsend: THTTPSend;
- ss: TStringStream;
- i,err:integer;
- rev:string;
- begin
- Header := TStringList.Create;
- Contents := TStringList.Create;
- ss := TStringStream.Create('');
- httpsend:=THTTPSend.Create;
- HTTPsend.UserAgent:='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3';
- httpsend.Headers.Insert(0,'Referer: '+ref);//referer
- httpsend.Cookies.Text:=cooc; //coocies
- httpsend.MimeType:=mime;
- for i:=1 to 100 do begin
- if trim(headers[i])<>''then
- Header.Add(headers[i])
- else break;
- end;
- httpsend.Headers.AddStrings(Header); //headers
- if proxyTYPE='HTTP' then begin
- httpsend.ProxyHost:=proxy;
- httpsend.ProxyPort:=port;
- end else if proxyTYPE='SOCKS 4' then begin
- //HTTPsend.Sock.SocksType:=
- HTTPsend.Sock.SocksIP := proxy;
- HTTPsend.Sock.SocksPort := PORT;
- HTTPsend.Sock.SocksUsername := proxyUSER;
- HTTPsend.Sock.SocksPassword := proxyPASS;
- //HTTPsend.Sock.SocksOpen;
- end else if proxyTYPE='SOCKS 5' then begin
- //HTTP.Sock.SocksType := ST_Socks5 ;
- HTTPsend.Sock.SocksIP := proxy;
- HTTPsend.Sock.SocksPort := PORT;
- HTTPsend.Sock.SocksUsername := proxyUSER;
- HTTPsend.Sock.SocksPassword := proxyPASS;
- //HTTPsend.Sock.SocksOpen;
- end;
- if method='GET' then begin
- try
- httpsend.HTTPMethod('GET',zap );
- except
- //on EidSocketError do
- on E : Exception do
- result:='exception';
- end;
- end;
- if method='POST' then begin
- ss.WriteString(params);
- httpsend.Document.LoadFromStream(ss);
- httpsend.HTTPMethod('POST',zap);
- end;
- Contents.LoadFromStream(httpsend.Document);
- rev := Contents.Text;
- if pos('302',IntToStr(HTTPsend.ResultCode))<>0 then begin
- result:='302';
- err:=FoundLocationStrNum('change_mail',HTTPsend.Headers);
- if err>0 then
- result:='logout';
- err:=FoundLocationStrNum('changemail',HTTPsend.Headers);
- if err>0 then
- result:='changemail';
- err:=FoundLocationStrNum('hash',HTTPsend.Headers);
- if err>0 then
- result:=HTTPsend.Headers[FoundLocationStrNum('Location',HTTPsend.Headers)];
- end else if pos('500',IntToStr(HTTPsend.ResultCode))<>0 then begin
- result:='500';
- end else if pos('404',IntToStr(HTTPsend.ResultCode))<>0 then begin
- result:='404';
- end else if pos('400',IntToStr(HTTPsend.ResultCode))<>0 then begin
- result:='400';
- end else
- result:=rev;
- httpsend.Free;
- header.Free;
- contents.Free;
- ss.Free;
- exit;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement