Skip to content

Commit 19dea94

Browse files
committed
Added sources to work with HTTP GET. Maybe, I’ll add some utils for URLencoding?
1 parent 5a31be5 commit 19dea94

File tree

8 files changed

+404
-0
lines changed

8 files changed

+404
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
program AplusB_Get;
2+
3+
uses
4+
Vcl.Forms,
5+
Curl.Lib in '..\..\..\Src\Curl.Lib.pas',
6+
Curl.RawByteStream in '..\..\..\Src\Curl.RawByteStream.pas',
7+
Curl.Easy in '..\..\..\Src\Curl.Easy.pas',
8+
Curl.Form in '..\..\..\Src\Curl.Form.pas',
9+
f_Main in 'f_Main.pas' {fmMain},
10+
Curl.Interfaces in '..\..\..\Src\Curl.Interfaces.pas',
11+
Curl.Slist in '..\..\..\Src\Curl.Slist.pas';
12+
13+
{$R *.res}
14+
15+
begin
16+
Application.Initialize;
17+
Application.MainFormOnTaskbar := True;
18+
Application.CreateForm(TfmMain, fmMain);
19+
Application.Run;
20+
end.
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<ProjectGuid>{D3B4B685-2E00-4D4F-AE2D-ED7C28AB5A9A}</ProjectGuid>
4+
<ProjectVersion>13.4</ProjectVersion>
5+
<FrameworkType>VCL</FrameworkType>
6+
<MainSource>AplusB_Get.dpr</MainSource>
7+
<Base>True</Base>
8+
<Config Condition="'$(Config)'==''">Debug</Config>
9+
<Platform Condition="'$(Platform)'==''">Win64</Platform>
10+
<TargetedPlatforms>3</TargetedPlatforms>
11+
<AppType>Application</AppType>
12+
</PropertyGroup>
13+
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
14+
<Base>true</Base>
15+
</PropertyGroup>
16+
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
17+
<Base_Win64>true</Base_Win64>
18+
<CfgParent>Base</CfgParent>
19+
<Base>true</Base>
20+
</PropertyGroup>
21+
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
22+
<Base_Win32>true</Base_Win32>
23+
<CfgParent>Base</CfgParent>
24+
<Base>true</Base>
25+
</PropertyGroup>
26+
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
27+
<Cfg_1>true</Cfg_1>
28+
<CfgParent>Base</CfgParent>
29+
<Base>true</Base>
30+
</PropertyGroup>
31+
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
32+
<Cfg_1_Win32>true</Cfg_1_Win32>
33+
<CfgParent>Cfg_1</CfgParent>
34+
<Cfg_1>true</Cfg_1>
35+
<Base>true</Base>
36+
</PropertyGroup>
37+
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
38+
<Cfg_2>true</Cfg_2>
39+
<CfgParent>Base</CfgParent>
40+
<Base>true</Base>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Base)'!=''">
43+
<DCC_UsePackage>fmx;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;DbxCommonDriver;dbxcds;DBXOracleDriver;CustomIPTransport;dsnap;fmxase;inetdbxpress;bindcompfmx;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;xmlrtl;DBXMySQLDriver;bindengine;soaprtl;DBXInformixDriver;DBXFirebirdDriver;inet;fmxobj;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
44+
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
45+
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
46+
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
47+
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
48+
<DCC_E>false</DCC_E>
49+
<DCC_N>false</DCC_N>
50+
<DCC_S>false</DCC_S>
51+
<DCC_F>false</DCC_F>
52+
<DCC_K>false</DCC_K>
53+
</PropertyGroup>
54+
<PropertyGroup Condition="'$(Base_Win64)'!=''">
55+
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
56+
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
57+
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
58+
<VerInfo_Locale>1033</VerInfo_Locale>
59+
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
60+
<DCC_UsePackage>DBXSybaseASEDriver;vclimg;vcldb;vcldsnap;DBXDb2Driver;vcl;DBXMSSQLDriver;webdsnap;adortl;DBXOdbcDriver;vclactnband;bindcompvcl;vclie;vcltouch;websnap;VclSmp;dsnapcon;vclx;$(DCC_UsePackage)</DCC_UsePackage>
61+
</PropertyGroup>
62+
<PropertyGroup Condition="'$(Base_Win32)'!=''">
63+
<DCC_UsePackage>JvGlobus;JvMM;JvManagedThreads;JvDlgs;IndySystem;JvCrypt;TeeDB;Rave100VCL;vclib;inetdbbde;JvNet;JvDotNetCtrls;DBXSybaseASEDriver;vclimg;fmi;vcldb;vcldsnap;DBXDb2Driver;Intraweb_120_160;JvCore;vclribbon;frxe16;vcl;IndyCore;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;JvDB;JvRuntimeDesign;webdsnap;GR32_DSGN_RSXE2;JclDeveloperTools;JvDocking;adortl;JvWizards;JvHMI;vcldbx;frx16;JvPluginSystem;Tee;DBXOdbcDriver;JvCmp;JvSystem;svnui;ibxpress;JvTimeFramework;JvControls;IndyProtocols;intrawebdb_120_160;frxDB16;fs16;vclactnband;FMXTee;TeeUI;JvJans;bindcompvcl;JvStdCtrls;JvCustom;Jcl;vclie;JvPageComps;JvPrintPreview;vcltouch;websnap;VclSmp;fsDB16;DataSnapConnectors;dsnapcon;JclVcl;JvPascalInterpreter;vclx;svn;bdertl;$(DCC_UsePackage)</DCC_UsePackage>
64+
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
65+
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
66+
<VerInfo_Locale>1033</VerInfo_Locale>
67+
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
68+
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
69+
</PropertyGroup>
70+
<PropertyGroup Condition="'$(Cfg_1)'!=''">
71+
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
72+
<DCC_Optimize>false</DCC_Optimize>
73+
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
74+
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
75+
<DCC_RemoteDebug>true</DCC_RemoteDebug>
76+
</PropertyGroup>
77+
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
78+
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
79+
<VerInfo_Locale>1033</VerInfo_Locale>
80+
<DCC_RemoteDebug>false</DCC_RemoteDebug>
81+
</PropertyGroup>
82+
<PropertyGroup Condition="'$(Cfg_2)'!=''">
83+
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
84+
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
85+
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
86+
<DCC_DebugInformation>false</DCC_DebugInformation>
87+
</PropertyGroup>
88+
<ItemGroup>
89+
<DelphiCompile Include="$(MainSource)">
90+
<MainSource>MainSource</MainSource>
91+
</DelphiCompile>
92+
<DCCReference Include="..\..\..\Src\Curl.Lib.pas"/>
93+
<DCCReference Include="..\..\..\Src\Curl.RawByteStream.pas"/>
94+
<DCCReference Include="..\..\..\Src\Curl.Easy.pas"/>
95+
<DCCReference Include="..\..\..\Src\Curl.Form.pas"/>
96+
<DCCReference Include="f_Main.pas">
97+
<Form>fmMain</Form>
98+
</DCCReference>
99+
<DCCReference Include="..\..\..\Src\Curl.Interfaces.pas"/>
100+
<DCCReference Include="..\..\..\Src\Curl.Slist.pas"/>
101+
<BuildConfiguration Include="Release">
102+
<Key>Cfg_2</Key>
103+
<CfgParent>Base</CfgParent>
104+
</BuildConfiguration>
105+
<BuildConfiguration Include="Base">
106+
<Key>Base</Key>
107+
</BuildConfiguration>
108+
<BuildConfiguration Include="Debug">
109+
<Key>Cfg_1</Key>
110+
<CfgParent>Base</CfgParent>
111+
</BuildConfiguration>
112+
</ItemGroup>
113+
<ProjectExtensions>
114+
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
115+
<Borland.ProjectType/>
116+
<BorlandProject>
117+
<Delphi.Personality>
118+
<VersionInfo>
119+
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
120+
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
121+
<VersionInfo Name="MajorVer">1</VersionInfo>
122+
<VersionInfo Name="MinorVer">0</VersionInfo>
123+
<VersionInfo Name="Release">0</VersionInfo>
124+
<VersionInfo Name="Build">0</VersionInfo>
125+
<VersionInfo Name="Debug">False</VersionInfo>
126+
<VersionInfo Name="PreRelease">False</VersionInfo>
127+
<VersionInfo Name="Special">False</VersionInfo>
128+
<VersionInfo Name="Private">False</VersionInfo>
129+
<VersionInfo Name="DLL">False</VersionInfo>
130+
<VersionInfo Name="Locale">1049</VersionInfo>
131+
<VersionInfo Name="CodePage">1251</VersionInfo>
132+
</VersionInfo>
133+
<VersionInfoKeys>
134+
<VersionInfoKeys Name="CompanyName"/>
135+
<VersionInfoKeys Name="FileDescription"/>
136+
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
137+
<VersionInfoKeys Name="InternalName"/>
138+
<VersionInfoKeys Name="LegalCopyright"/>
139+
<VersionInfoKeys Name="LegalTrademarks"/>
140+
<VersionInfoKeys Name="OriginalFilename"/>
141+
<VersionInfoKeys Name="ProductName"/>
142+
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
143+
<VersionInfoKeys Name="Comments"/>
144+
</VersionInfoKeys>
145+
<Excluded_Packages>
146+
<Excluded_Packages Name="$(BDSBIN)\fmidesigner160.bpl">FMI Form designer and property and component editors</Excluded_Packages>
147+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclBaseExpert160.bpl">JCL Package containing common units for JCL Experts</Excluded_Packages>
148+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclDebugExpert160.bpl">JCL Debug IDE extension</Excluded_Packages>
149+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclProjectAnalysisExpert160.bpl">JCL Project Analyzer</Excluded_Packages>
150+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclFavoriteFoldersExpert160.bpl">JCL Open and Save IDE dialogs with favorite folders</Excluded_Packages>
151+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclRepositoryExpert160.bpl">JCL Package containing repository wizards</Excluded_Packages>
152+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclSIMDViewExpert160.bpl">JCL Debug Window of XMM registers</Excluded_Packages>
153+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JclStackTraceViewerExpert160.bpl">JCL Stack Trace Viewer</Excluded_Packages>
154+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvAppFrmDesign160.bpl">JVCL Application and Form Components</Excluded_Packages>
155+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvCoreDesign160.bpl">JVCL Core Components</Excluded_Packages>
156+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvBandsDesign160.bpl">JVCL Band Objects</Excluded_Packages>
157+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvDBDesign160.bpl">JVCL Database Components</Excluded_Packages>
158+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvCmpDesign160.bpl">JVCL Non-Visual Components</Excluded_Packages>
159+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvControlsDesign160.bpl">JVCL Visual Controls</Excluded_Packages>
160+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvCryptDesign160.bpl">JVCL Encryption and Compression</Excluded_Packages>
161+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvCustomDesign160.bpl">JVCL Custom Controls</Excluded_Packages>
162+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvDlgsDesign160.bpl">JVCL Dialog Components</Excluded_Packages>
163+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvDockingDesign160.bpl">JVCL Docking Components</Excluded_Packages>
164+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvDotNetCtrlsDesign160.bpl">JVCL DotNet Controls</Excluded_Packages>
165+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvGlobusDesign160.bpl">JVCL Globus Components</Excluded_Packages>
166+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvHMIDesign160.bpl">JVCL HMI Controls</Excluded_Packages>
167+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvJansDesign160.bpl">JVCL Jans Components</Excluded_Packages>
168+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvManagedThreadsDesign160.bpl">JVCL Managed Threads</Excluded_Packages>
169+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvMMDesign160.bpl">JVCL Multimedia and Image Components</Excluded_Packages>
170+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvNetDesign160.bpl">JVCL Network Components</Excluded_Packages>
171+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvPageCompsDesign160.bpl">JVCL Page Style Components</Excluded_Packages>
172+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvPascalInterpreterDesign160.bpl">JVCL Interpreter Components</Excluded_Packages>
173+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvPluginSystemDesign160.bpl">JVCL Plugin Components</Excluded_Packages>
174+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvPrintPreviewDesign160.bpl">JVCL Print Preview Components</Excluded_Packages>
175+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvRuntimeDesignDesign160.bpl">JVCL Runtime Design Components</Excluded_Packages>
176+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvStdCtrlsDesign160.bpl">JVCL Standard Controls</Excluded_Packages>
177+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvSystemDesign160.bpl">JVCL System Components</Excluded_Packages>
178+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvTimeFrameworkDesign160.bpl">JVCL Time Framework</Excluded_Packages>
179+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvWizardsDesign160.bpl">JVCL Wizard</Excluded_Packages>
180+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvXPCtrlsDesign160.bpl">JVCL XP Controls</Excluded_Packages>
181+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\JvBDEDesign160.bpl">JVCL BDE Components</Excluded_Packages>
182+
<Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\9.0\Bpl\_XE2.bpl">(untitled)</Excluded_Packages>
183+
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl160.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
184+
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k160.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
185+
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp160.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
186+
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k160.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
187+
<Excluded_Packages Name="$(BDSBIN)\dclofficexp160.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
188+
</Excluded_Packages>
189+
<Source>
190+
<Source Name="MainSource">AplusB_Get.dpr</Source>
191+
</Source>
192+
</Delphi.Personality>
193+
<Deployment/>
194+
<Platforms>
195+
<Platform value="Win64">True</Platform>
196+
<Platform value="Win32">True</Platform>
197+
</Platforms>
198+
</BorlandProject>
199+
<ProjectFileVersion>12</ProjectFileVersion>
200+
</ProjectExtensions>
201+
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
202+
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
203+
</Project>
292 KB
Binary file not shown.
292 KB
Binary file not shown.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
object fmMain: TfmMain
2+
Left = 0
3+
Top = 0
4+
AutoSize = True
5+
BorderIcons = [biSystemMenu, biMinimize]
6+
BorderStyle = bsSingle
7+
Caption = 'GET form demo'
8+
ClientHeight = 169
9+
ClientWidth = 306
10+
Color = clBtnFace
11+
Font.Charset = DEFAULT_CHARSET
12+
Font.Color = clWindowText
13+
Font.Height = -11
14+
Font.Name = 'Tahoma'
15+
Font.Style = []
16+
Padding.Left = 12
17+
Padding.Top = 8
18+
Padding.Right = 12
19+
Padding.Bottom = 8
20+
OldCreateOrder = False
21+
PixelsPerInch = 96
22+
TextHeight = 13
23+
object Label1: TLabel
24+
Left = 12
25+
Top = 38
26+
Width = 15
27+
Height = 13
28+
Caption = 'A='
29+
end
30+
object Label2: TLabel
31+
Left = 121
32+
Top = 38
33+
Width = 14
34+
Height = 13
35+
Caption = 'B='
36+
end
37+
object Label3: TLabel
38+
Left = 12
39+
Top = 11
40+
Width = 19
41+
Height = 13
42+
Caption = 'URL'
43+
end
44+
object edA: TEdit
45+
Left = 33
46+
Top = 35
47+
Width = 72
48+
Height = 21
49+
TabOrder = 0
50+
Text = '10'
51+
end
52+
object edB: TEdit
53+
Left = 141
54+
Top = 35
55+
Width = 72
56+
Height = 21
57+
TabOrder = 1
58+
Text = '20'
59+
end
60+
object btAdd: TButton
61+
Left = 219
62+
Top = 35
63+
Width = 75
64+
Height = 25
65+
Caption = 'Add them!'
66+
Default = True
67+
TabOrder = 2
68+
OnClick = btAddClick
69+
end
70+
object edUrl: TEdit
71+
Left = 37
72+
Top = 8
73+
Width = 257
74+
Height = 21
75+
TabOrder = 4
76+
Text = 'http://localhost/php_curl/aplusb_get/action.php'
77+
end
78+
object memoResponse: TMemo
79+
Left = 12
80+
Top = 66
81+
Width = 282
82+
Height = 95
83+
TabOrder = 3
84+
end
85+
end
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
unit f_Main;
2+
3+
interface
4+
5+
uses
6+
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
7+
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
8+
9+
type
10+
TfmMain = class(TForm)
11+
Label1: TLabel;
12+
Label2: TLabel;
13+
edA: TEdit;
14+
edB: TEdit;
15+
btAdd: TButton;
16+
edUrl: TEdit;
17+
Label3: TLabel;
18+
memoResponse: TMemo;
19+
procedure btAddClick(Sender: TObject);
20+
private
21+
{ Private declarations }
22+
public
23+
{ Public declarations }
24+
end;
25+
26+
var
27+
fmMain: TfmMain;
28+
29+
implementation
30+
31+
uses
32+
Curl.Interfaces, Curl.Easy, Curl.Form, Curl.Lib, Curl.RawByteStream,
33+
Curl.Slist;
34+
35+
{$R *.dfm}
36+
37+
procedure TfmMain.btAddClick(Sender: TObject);
38+
const
39+
UserAgent : PAnsiChar =
40+
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0';
41+
var
42+
curl : ICurl;
43+
form : ICurlForm;
44+
stream : TRawByteStream;
45+
begin
46+
curl := CurlGet;
47+
form := CurlGetForm;
48+
stream := TRawByteStream.Create;
49+
50+
curl.SetUrl(edUrl.Text);
51+
// I tested it on my free hosting — it has a bot protection.
52+
curl.SetUserAgent(UserAgent);
53+
form.Add('a', edA.Text);
54+
form.Add('b', edB.Text);
55+
56+
curl.Form := form;
57+
curl.SetOpt(CURLOPT_HTTPGET, true);
58+
curl.SetRecvStream(stream, [csfAutoDestroy]);
59+
curl.Perform;
60+
memoResponse.Text := string(stream.Data);
61+
end;
62+
63+
end.
64+

php_curl/aplusb_get/action.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
function at($arr, $ind)
4+
{
5+
if (isset($arr[$ind]))
6+
return $arr[$ind];
7+
else return '';
8+
}
9+
10+
$a = at($_GET, 'a');
11+
$b = at($_GET, 'b');
12+
13+
header('Content-Type: text/plain; charset=utf-8');
14+
15+
$c = $a + $b;
16+
17+
echo "a + b = $c";
18+
19+
?>

0 commit comments

Comments
 (0)