Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.Button1Click(Sender: TObject);
- var
- S: tstringlist;
- html: string;
- clHttpRequest1: tclHttpRequest;
- SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
- params: TIdMultiPartFormDataStream;
- HTTP, HTTP2: tidhttp;
- begin
- params := TIdMultiPartFormDataStream.Create;
- S := tstringlist.Create;
- HTTP2 := tidhttp.Create(nil);
- try
- cookie := tidcookiemanager.Create(nil);
- SSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
- HTTP2.IOHandler := SSLIOHandlerSocketOpenSSL;
- HTTP2.HandleRedirects := False;
- HTTP2.ConnectTimeout := 10000;
- HTTP2.ReadTimeout := 10000;
- HTTP2.CookieManager := cookie;
- HTTP2.AllowCookies := True;
- HTTP2.Request.UserAgent :=
- 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36';
- HTTP2.Request.ContentType := 'application/x-www-form-urlencoded';
- HTTP2.Request.ContentEncoding := 'gzip, deflate';
- HTTP2.Request.Accept := '*/*';
- HTTP2.Request.Connection := 'Keep-Alive';
- S.Values['auth'] := 'email@gmail.com';
- S.Values['pass'] := 'password';
- S.Values['app_id'] := '5hwaJUcDicXprlV3gjaB';
- S.Values['app_session'] := '288196272';
- html := HTTP2.Post('https://www.oboom.com/1.0/login', S);
- finally
- HTTP2.Free;
- S.Free;
- end;
- token := ExtractBetween(html, 'session":"', '"');
- try
- HTTP := tidhttp.Create;
- HTTP.HandleRedirects := True;
- HTTP.Request.Connection := 'keep-alive';
- HTTP.AllowCookies := True;
- HTTP.CookieManager := cookie;
- HTTP.Request.Referer := 'http://upload.oboom.com';
- HTTP.Request.ContentType :=
- 'multipart/form-data; boundary=----------GI3Ef1cH2GI3gL6ae0Ef1KM7Ef1gL6';
- HTTP.Request.Accept := '*/*';
- HTTP.Request.AcceptEncoding := 'gzip,deflate';
- HTTP.ConnectTimeout := 20000;
- HTTP.ReadTimeout := 20000;
- HTTP.Request.UserAgent :=
- 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36';
- params.AddFile('file', 'C:UsersMPicturesMartin.jpg', );
- HTTP.Post('http://upload.oboom.com/1.0/ul?token=' + token +
- '&parent=1&name_policy=rename', params);
- finally
- HTTP.Free;
- params.Free;
- cookie.Free;
- end;
- memo1.Text := html;
- end;
- Params.AddFile('file', 'C:UsersMPicturesMartin.jpg','application/octet-stream');
- Params.AddFile('file', 'C:UsersMPicturesMartin.jpg','multipart/form-data');
- HTTP2.Request.ContentEncoding := 'gzip, deflate';
- HTTP.Request.AcceptEncoding := 'gzip,deflate';
- HTTP.Request.ContentType :=
- 'multipart/form-data; boundary=----------GI3Ef1cH2GI3gL6ae0Ef1KM7Ef1gL6';
- params.AddFile(...).ContentTransfer := '';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement