Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3. S: tstringlist;
  4. html: string;
  5. clHttpRequest1: tclHttpRequest;
  6. SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
  7. params: TIdMultiPartFormDataStream;
  8. HTTP, HTTP2: tidhttp;
  9. begin
  10. params := TIdMultiPartFormDataStream.Create;
  11. S := tstringlist.Create;
  12. HTTP2 := tidhttp.Create(nil);
  13. try
  14. cookie := tidcookiemanager.Create(nil);
  15. SSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  16. HTTP2.IOHandler := SSLIOHandlerSocketOpenSSL;
  17. HTTP2.HandleRedirects := False;
  18. HTTP2.ConnectTimeout := 10000;
  19. HTTP2.ReadTimeout := 10000;
  20. HTTP2.CookieManager := cookie;
  21. HTTP2.AllowCookies := True;
  22. HTTP2.Request.UserAgent :=
  23. 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36';
  24. HTTP2.Request.ContentType := 'application/x-www-form-urlencoded';
  25. HTTP2.Request.ContentEncoding := 'gzip, deflate';
  26. HTTP2.Request.Accept := '*/*';
  27. HTTP2.Request.Connection := 'Keep-Alive';
  28. S.Values['auth'] := 'email@gmail.com';
  29. S.Values['pass'] := 'password';
  30. S.Values['app_id'] := '5hwaJUcDicXprlV3gjaB';
  31. S.Values['app_session'] := '288196272';
  32. html := HTTP2.Post('https://www.oboom.com/1.0/login', S);
  33. finally
  34. HTTP2.Free;
  35. S.Free;
  36. end;
  37. token := ExtractBetween(html, 'session":"', '"');
  38. try
  39. HTTP := tidhttp.Create;
  40. HTTP.HandleRedirects := True;
  41. HTTP.Request.Connection := 'keep-alive';
  42. HTTP.AllowCookies := True;
  43. HTTP.CookieManager := cookie;
  44. HTTP.Request.Referer := 'http://upload.oboom.com';
  45. HTTP.Request.ContentType :=
  46. 'multipart/form-data; boundary=----------GI3Ef1cH2GI3gL6ae0Ef1KM7Ef1gL6';
  47. HTTP.Request.Accept := '*/*';
  48. HTTP.Request.AcceptEncoding := 'gzip,deflate';
  49. HTTP.ConnectTimeout := 20000;
  50. HTTP.ReadTimeout := 20000;
  51. HTTP.Request.UserAgent :=
  52. 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36';
  53. params.AddFile('file', 'C:UsersMPicturesMartin.jpg', );
  54. HTTP.Post('http://upload.oboom.com/1.0/ul?token=' + token +
  55. '&parent=1&name_policy=rename', params);
  56. finally
  57. HTTP.Free;
  58. params.Free;
  59. cookie.Free;
  60. end;
  61. memo1.Text := html;
  62. end;
  63.  
  64. Params.AddFile('file', 'C:UsersMPicturesMartin.jpg','application/octet-stream');
  65. Params.AddFile('file', 'C:UsersMPicturesMartin.jpg','multipart/form-data');
  66.  
  67. HTTP2.Request.ContentEncoding := 'gzip, deflate';
  68.  
  69. HTTP.Request.AcceptEncoding := 'gzip,deflate';
  70.  
  71. HTTP.Request.ContentType :=
  72. 'multipart/form-data; boundary=----------GI3Ef1cH2GI3gL6ae0Ef1KM7Ef1gL6';
  73.  
  74. params.AddFile(...).ContentTransfer := '';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement