Ok I have a Code i have been playing with, currently i am studying Wininet and i want to send the parameters by GET request so my php can save it in the database.
Code Looks like this
program InfoWininet;
{$mode delphi}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes , Windows , Wininet
{ you can add units after this };
var
FirstName : string;
LastName: string;
Email: string ;
Sex : string;
IDNumber: string;
IOpen, IURL: HINTERNET;
Read: Cardinal;
URL : string;
data: string;
Result : string;
begin
Writeln('Enter Your First Name: ');
Readln(FirstName);
Writeln('Enter your Last Name: ');
Readln(LastName);
Writeln('Enter Your Email: ');
Readln(Email);
Writeln('Enter your ID Number: ');
Readln(IDNumber);
data := URL + 'data.php?fname=' + FirstName + '&lastName=' + LastName + '&Email=' + Email + '&IdNumber=' + IDNumber;
begin
Result:='';
try
IOpen := InternetOpen('Oxysys',INTERNET_OPEN_TYPE_PRECONFIG, '', '',INTERNET_FLAG_NEED_FILE);
if IOpen<>nil then
try
IURL:= InternetOpenUrl(IOpen, 'localhost', nil, 0,INTERNET_FLAG_DONT_CACHE, 0);
if IURL<> nil then
try
SetLength(data,4096);
repeat
if InternetReadFile(IURL,@data[1],4096,Read) then
Result:=Result + Copy(data,1,Read)
else
Break;
until Read = 0;
finally
InternetCloseHandle(IURL);
end;
finally
InternetCloseHandle(IOpen);
end;
except
end;
end;
end.
Errors i gat looks like this, i want it to output ''Message transfered" i can code a script to save in db using php, but what is wrong with this code
InfoWininet.lpr(34,13) Warning: Variable "URL" does not seem to be initialized
InfoWininet.lpr(46,45) Hint: Variable "Read" does not seem to be initialized
InfoWininet.lpr(57,1) Fatal: Syntax error, "EXCEPT" expected but "END" found