Delphi Http get request issue via /r/learnprogramming


Delphi Http get request issue

trying to learn some of the basics of Pascal in Delphi. ran into an error with the get request, I simply get an access violation error on the http.Get line.

The code I have is: (alt screen shot if you like the colours http://ift.tt/2u1A2TL)

unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdHTTP; type TForm2 = class(TForm) Button1: TButton; Edit1: TEdit; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation {$R *.dfm} uses Unit1; procedure TForm2.Button1Click(Sender: TObject); var Form1: TForm1; begin Form1 := TForm1.Create(nil); try Form1.ShowModal; finally Form1.Free; end; end; procedure TForm2.Button2Click(Sender: TObject); var http: TIdHTTP; var Result: string; begin http := http.Create; try Result := http.Get('http://ift.tt/2sJ7p9W;) finally http.Free; end; Edit1.Text := Result; end; end. 

Submitted July 10, 2017 at 04:56PM by craig395
via reddit http://ift.tt/2t6Xlae

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s