idhttp

Download file progressively using TIdHttp

只愿长相守 提交于 2019-12-03 02:50:01
问题 I want to implement a simple http downloader using TIdHttp (Indy10). I found two kind of code examples from the internet. Unfortunately none of them satisfy me 100%. Here is the code and I want some advise. Variant 1 var Buffer: TFileStream; HttpClient: TIdHttp; begin Buffer := TFileStream.Create('somefile.exe', fmCreate or fmShareDenyWrite); try HttpClient := TIdHttp.Create(nil); try HttpClient.Get('http://somewhere.com/somefile.exe', Buffer); // wait until it is done finally HttpClient.Free

Download file progressively using TIdHttp

依然范特西╮ 提交于 2019-12-02 16:21:16
I want to implement a simple http downloader using TIdHttp (Indy10). I found two kind of code examples from the internet. Unfortunately none of them satisfy me 100%. Here is the code and I want some advise. Variant 1 var Buffer: TFileStream; HttpClient: TIdHttp; begin Buffer := TFileStream.Create('somefile.exe', fmCreate or fmShareDenyWrite); try HttpClient := TIdHttp.Create(nil); try HttpClient.Get('http://somewhere.com/somefile.exe', Buffer); // wait until it is done finally HttpClient.Free; end; finally Buffer.Free; end; end; The code is compact and very easy to understand. The problem is

How to login to Instagram website using IdHTTP in delphi10

我的梦境 提交于 2019-12-02 12:40:26
问题 I am trying to login to instagram website using idhttp in Delphi. I used google chrome developer tools to get the data and this is what I've tried so far.. procedure TForm1.Button1Click(Sender: TObject); var lHTTP: TIdHTTP; S,M : TStrings; IdSSL: TIdSSLIOHandlerSocketOpenSSL; begin S := TStringList.Create; S.Add('username :' +Edit1.Text); S.Add('password :'+ Edit2.Text); lHTTP := TIdHTTP.Create(nil); lHTTP.ReadTimeout := 30000; lHTTP.HandleRedirects := True; IdSSL :=

How to login to Instagram website using IdHTTP in delphi10

时光毁灭记忆、已成空白 提交于 2019-12-02 06:28:05
I am trying to login to instagram website using idhttp in Delphi. I used google chrome developer tools to get the data and this is what I've tried so far.. procedure TForm1.Button1Click(Sender: TObject); var lHTTP: TIdHTTP; S,M : TStrings; IdSSL: TIdSSLIOHandlerSocketOpenSSL; begin S := TStringList.Create; S.Add('username :' +Edit1.Text); S.Add('password :'+ Edit2.Text); lHTTP := TIdHTTP.Create(nil); lHTTP.ReadTimeout := 30000; lHTTP.HandleRedirects := True; IdSSL := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP); IdSSL.SSLOptions.Method := sslvTLSv1; IdSSL.SSLOptions.Mode := sslmClient; lHTTP

Error 406 Not Acceptable with idHTTP on Android

孤街浪徒 提交于 2019-12-02 00:06:12
I'm trying to post a insert on a MySQL database using idHTTP and a PHP script. This is the PHP script to insert in the database: $mysqli = new mysqli($servidor, $usuario, $senha, $banco); // Caso algo tenha dado errado, exibe uma mensagem de erro if (mysqli_connect_errno()) trigger_error(mysqli_connect_error()); $iduser = quoted_printable_decode($_POST['iduser']); $nome = quoted_printable_decode($_POST['nome']); $data = quoted_printable_decode($_POST['data']); $hora = quoted_printable_decode($_POST['hora']); $mensagem = quoted_printable_decode($_POST['mensagem']); $latitude = quoted_printable

TIdHTTP character encoding of POST response

人盡茶涼 提交于 2019-12-01 15:31:23
问题 Take following situation: procedure Test; var Response : String; begin Response := IdHttp.Post(MyUrL, AStream); DoSomethingWith(Response); end; Now the webserver returns me data in UTF-8. Suppose it returns me some UTF-8 XML containing the character é. If I use the variable Response it does not contain this character but it's UTF-8 variant (#C3#A9), so Indy did no decoding? Now I know how to solve this problem: procedure Test; var Response : String; begin Response := UTF8ToString(IdHttp.Post

File upload fails, when posting with Indy and filename contains Greek characters

拜拜、爱过 提交于 2019-12-01 08:38:45
问题 I am trying to implement a POST to a web service. I need to send a file whose type is variable ( .docx , .pdf , .txt ) along with a JSON formatted string. I have manage to post files successfully with code similar to the following: procedure DoRequest; var Http: TIdHTTP; Params: TIdMultipartFormDataStream; RequestStream, ResponseStream: TStringStream; JRequest, JResponse: TJSONObject; url: string; begin url := 'some_custom_service' JRequest := TJSONObject.Create; JResponse := TJSONObject

How to use threads with idhttp in delphi 10

梦想的初衷 提交于 2019-12-01 01:30:35
i need help to speedup my project,i have 2 ListBoxs, the first is full with URLs, the second i store in it the URLs that causes 404 error from Listbox1, its just checking process. the idhttp takes about 2s to check 1 url, i dont need the html, cause the decryption process takes time, So i decided to add threads in my project, my code so far unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdSSLOpenSSL, Vcl.StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;

How to use threads with idhttp in delphi 10

折月煮酒 提交于 2019-11-30 20:51:47
问题 i need help to speedup my project,i have 2 ListBoxs, the first is full with URLs, the second i store in it the URLs that causes 404 error from Listbox1, its just checking process. the idhttp takes about 2s to check 1 url, i dont need the html, cause the decryption process takes time, So i decided to add threads in my project, my code so far unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl

How do I include a file in a TIdMultiPartFormDataStream for use with Indy IdHTTP1.Post?

允我心安 提交于 2019-11-29 15:30:47
What is the correct code that I need to use to send one or more files of any type along with other parameters using Indy's idHTTP.post? (using Delphi 2009 and Indy 10) The post in question calls a function in a commercial company's API (ElasticEmail) that sends out emails to the recipients held in one of the parameters. (A link to the documentation on the function I am calling is here. I have example code in C# and other languages from the company here and I have tried to replicate that code in my Delphi code below. If, in Procedure btnSendbyElastic, I comment out the line Filenames.add