linkedin facebook linkedin facebook nod32

Delphi da sms yuborish texnologiyasi

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2014-10-27

Delphi da sms yuborish texnologiyasi


Dastur dizayni quyidagicha rasm 1.

rasm 1.

Dastur kodi
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, IdBaseComponent, IdComponent, IdTCPServer,
IdCustomHTTPServer, IdHTTPServer, IdTCPConnection, IdTCPClient, IdHTTP,
StdCtrls, WallPaper, GifCode, GIFImage, Gif, JPEG, Buttons, ComCtrls;

type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
ImageGIF: TImage;
kod: TEdit;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
sms: TMemo;
Image1: TImage;
s_set: TRadioGroup;
StatusBar1: TStatusBar;
tnom: TComboBox;
Button1: TButton;
Button3: TBitBtn;
Button2: TBitBtn;
Image2: TImage;
kr: TRadioButton;
la: TRadioButton;
Label5: TLabel;

procedure ComboBox1CloseUp(Sender: TObject);
procedure Refresh_Beeline;
procedure Refresh_MTS;
procedure Send_SMS_MTS;
procedure Send_SMS_Beeline;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure s_setClick(Sender: TObject);
procedure Image2Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
s1,s2, ps, ris1, lmod, nomer: string;
implementation

uses StrUtils, Unit2;

{$R *.dfm}

procedure TForm1.ComboBox1CloseUp(Sender: TObject);
begin
if s_set.ItemIndex=0 Then
Begin
if ComboBox1.ItemIndex=0 Then
nomer:='99897';
if ComboBox1.ItemIndex=1 Then
nomer:='99892';
if ComboBox1.ItemIndex=2 Then
nomer:='99861';
if ComboBox1.ItemIndex=3 Then
nomer:='99862';
if ComboBox1.ItemIndex=4 Then
nomer:='99865';
if ComboBox1.ItemIndex=5 Then
nomer:='99866';
if ComboBox1.ItemIndex=6 Then
nomer:='99867';
if ComboBox1.ItemIndex=7 Then
nomer:='99869';
if ComboBox1.ItemIndex=8 Then
nomer:='99871';
if ComboBox1.ItemIndex=9 Then
nomer:='99870';
if ComboBox1.ItemIndex=10 Then
nomer:='99872';
if ComboBox1.ItemIndex=11 Then
nomer:='99873';
if ComboBox1.ItemIndex=12 Then
nomer:='99874';
if ComboBox1.ItemIndex=13 Then
nomer:='99875';
if ComboBox1.ItemIndex=14 Then
nomer:='99876';
if ComboBox1.ItemIndex=15 Then
nomer:='99879';
end;
if s_set.ItemIndex=0 Then
Begin
if ComboBox1.ItemIndex=0 Then
nomer:='99890';
if ComboBox1.ItemIndex=1 Then
nomer:='99891';
end;

end;
//---------------------------------------------------------------------
procedure TForm1.Send_SMS_MTS;
var
tn, til, n, a:string;
sl: TStringList;
begin
tn:=copy(tnom.Text,1,pos('-',tnom.Text)-1);
if Length(sms.Text)<160 Then
Begin
sl := TStringList.Create;
if kr.Checked=True Then til:='1'
else til:='0';
try
sl.CommaText:='action=sms_ok&'
+'sid='+s1
+'&dt='+s2
+'&branch='+nomer
+'&daddr='+Tn
+'&sms_text='+sms.Text
+'&rl='+Inttostr(160-Length(sms.Text))
+'&lang='+til
+'&bod='+kod.Text;
IdHTTP1.AllowCookies:= True;
IdHTTP1.HandleRedirects:= True;
IdHTTP1.Request.UserAgent:= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
idHTTP1.Request.ContentType:='application/x-www-form-urlencoded';
IdHTTP1.Post('http://sms.mts.uz/sms.php', sl);
ShowMessage('SMS jo''''natildi');
StatusBar1.Panels.Items[0].Text:='SMS jo''''natildi';
finally
sl.Free;
end;
end
else Begin
ShowMessage('SMS 160 na belgidan ortmasligi kerak');
StatusBar1.Panels.Items[0].Text:='SMS 160 na belgidan ortmasligi kerak';
end;
end;
//---------------------------------------------------------------------
procedure TForm1.Refresh_MTS;
var
txt,ris,txt1,ss,lres:string;
sPos, fPos,spos1,fpos1,lpos,lpos2: Integer;
ltxt,ltxt1: Integer;
lStream: TMemoryStream;
str, s: String;
ps1, ps2, ps3: string;
begin
txt := IdHTTP1.Get('http://sms.mts.uz/sms.php');
s:=txt;
delete(s,1,pos('"sid"',s));
delete(s,1,pos('"',s));
delete(s,1,pos('"',s));
s1:=copy(s,1,pos('"',s)-1);
delete(s,1,pos('"dt"',s));
delete(s,1,pos('"',s));
delete(s,1,pos('"',s));
s2:=copy(s,1,pos('"',s)-1);
str:=s1+'_'+s2+'.gif';//" width="72" height="28" alt="" border="0" align="absbottom';
sPos := Pos(str, txt);
if sPos > 0 then
begin
ltxt := Length(str);
Inc(sPos, ltxt);
fPos := sPos;
while (fPos <= ltxt) and (txt[sPos] <> '"')
do Inc(fPos);
begin
lStream := TMemoryStream.Create;

try
IdHTTP1.Get('http://sms.mts.uz/aspam2/'+str, lStream);
lStream.SaveToFile('1.gif');
ImageGIF.Picture.LoadFromFile('1.gif');
lStream.Position := 0;
finally
lStream.Free;
///----------------------------------------
ps:=txt;
end;
end;
end;
end;
//---------------------------------------------------------------------
procedure TForm1.Refresh_Beeline;
const
C_Url='cgi.exe?function=sms_show_antispam_image&ImageNumber=';
var
txt,ris,txt1,ss,lres:string;
sPos, fPos,spos1,fpos1,lpos,lpos2: Integer;
ltxt,ltxt1: Integer;
lStream: TMemoryStream;
str, s: String;
ps1, ps2, ps3: string;

begin
txt := IdHTTP1.Get('http://beeline.uz/sms/sms.php');
s:=txt;
delete(s,1,pos('count.php?text=',s)-1);
s1:=copy(s,1,pos('"',s)-1);
str:=s1;
lStream := TMemoryStream.Create;
try
IdHTTP1.Get('http://beeline.uz/sms/'+str, lStream);
lStream.SaveToFile('2.jpg');
Image1.Picture.LoadFromFile('2.jpg');
lStream.Position := 0;
finally
lStream.Free;
end;
end;
//---------------------------------------------------------------------
procedure TForm1.Send_SMS_Beeline;
var
tn, ss: string;
st: TStringList;
begin
if Length(sms.Text)<160 Then
Begin
tn:=copy(tnom.Text,1,pos('-',tnom.Text)-1);
st:=TStringList.Create;
ss:='deferto=&adv_year=&send=&op=send_sms&dlina=%3Cbr+'+
'%2F%3E%0A%3Cb%3ENotice%3C%2Fb%3E%3A++Undef'+
'ined+variable%3A+message_limit+in+%3Cb%3EF%3A%5C'+
'WWW%5Cwb25_beeline_uz%5Csms%5Csms.php%3C%2'+
'Fb%3E+on+line+%3Cb%3E687%3C%2Fb%3E%3Cbr+%2F'+
'%3E%0A&lg=latrus&phone_prefix='+nomer+'&phone_num='+tn+
'&text_message='+sms.Text+
'&lang=latrus&message_limit'+
'=155&confirm_key=&code_form='+kod.Text+'&x=32&y=4'+#13+#13;
st.Add(ss);

IdHTTP1.AllowCookies:= True;
IdHTTP1.HandleRedirects:= True;
idHTTP1.Request.ContentType:='application/x-www-form-urlencoded';
IdHTTP1.Post('http://beeline.uz/sms/sms.php', st);
ShowMessage('SMS jo''''natildi');
StatusBar1.Panels.Items[0].Text:='SMS jo''''natildi';
end
else ShowMessage('SMS 160 na belgidan ortmasligi kerak');
end;
//---------------------------------------------------------------------
procedure TForm1.Button2Click(Sender: TObject);
begin
if s_set.ItemIndex=0 Then
Begin
Send_SMS_MTS;
end;
if s_set.ItemIndex=1 Then
Begin
Send_SMS_Beeline;
end;
end;
//---------------------------------------------------------------------
procedure TForm1.Button3Click(Sender: TObject);
begin
//if FormatDateTime('01.15.2008 00:00:01',now)> FormatDateTime('mm.dd.yyyy',now) Then
//Begin
if s_set.ItemIndex=0 Then
Begin
Image1.Picture.LoadFromFile('22.jpg');
Refresh_MTS;
end;
if s_set.ItemIndex=1 Then
Begin
ImageGIF.Picture.LoadFromFile('11.gif');
Refresh_Beeline;
end;
//end
//else
//Form1.Close;
end;
//---------------------------------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
s: string;
fstr: TStringList;
begin

Label5.Hide;
fstr:=TStringList.Create;
fstr.LoadFromFile('tel_book.txt');
for i:=0 to fstr.Count-1 do
Begin
s:=fstr.Strings[i];
tnom.Items.Add(s);
end;

end;
//---------------------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin

if tnom.Items.IndexOf(tnom.Text)=-1 then
begin
tnom.Items.Add(tnom.Text);
tnom.Items.SaveToFile(ExtractFilePath(ParamStr(0))+'tel_book.txt');
end;
end;
//---------------------------------------------------------------------
procedure TForm1.s_setClick(Sender: TObject);
begin
if s_set.ItemIndex=0 Then
begin
ComboBox1.Items.Clear;
ComboBox1.Items.Add('Ташкент - 99897');
ComboBox1.Items.Add('TiME (PrePaid) - 99892');
ComboBox1.Items.Add('Нукус - 99861');
ComboBox1.Items.Add('Ургенч - 99862');
ComboBox1.Items.Add('Бухара - 99865');
ComboBox1.Items.Add('Самарканд - 99866');
ComboBox1.Items.Add('Гулистан - 99867');
ComboBox1.Items.Add('Наманган - 99869');
ComboBox1.Items.Add('Алмалык, Ангрен, Янгиюль, Чирчик - 99871');
ComboBox1.Items.Add('Алмалык, Ангрен, Янгиюль, Чирчик - 99870');
ComboBox1.Items.Add('Джизак - 99872');
ComboBox1.Items.Add('Фергана, Коканд - 99873');
ComboBox1.Items.Add('Андижан - 99874');
ComboBox1.Items.Add('Карши, Шахрисабз - 99875');
ComboBox1.Items.Add('Термез, Денау - 99876');
ComboBox1.Items.Add('Навои, Зарафшан - 99879');
end;
if s_set.ItemIndex=1 Then
begin
ComboBox1.Items.Clear;
ComboBox1.Items.Add('99890');
ComboBox1.Items.Add('99891');
end;
if s_set.ItemIndex=1 Then
Begin
//ComboBox1.Enabled:=False;
kr.Enabled:=False;
la.Enabled:=False;
Label5.Show;
end
else
Begin
//ComboBox1.Enabled:=true;
kr.Enabled:=True;
la.Enabled:=True;
Label5.Hide;
end;
end;
//-----------------------------------------------------------------------
procedure TForm1.Image2Click(Sender: TObject);
begin
Application.CreateForm(Tform2,Form2);
Form2.ShowModal;
end;

end.

Dastur dizayni Form2 rasm 2.

rasm 2.

Dastur kodi
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;

type
TForm2 = class(TForm)
Button2: TBitBtn;
s_set: TRadioGroup;
Edit1: TEdit;
Memo1: TMemo;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
GroupBox1: TGroupBox;
Edit3: TEdit;
Edit4: TEdit;
Label5: TLabel;
Label6: TLabel;
BitBtn1: TBitBtn;
Label7: TLabel;
Edit5: TEdit;
Label8: TLabel;
Edit6: TEdit;
CheckBox1: TCheckBox;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.BitBtn1Click(Sender: TObject);
begin
Form1.IdHTTP1.ProxyParams.ProxyPort:=StrtoInt(Edit3.text);
Form1.IdHTTP1.ProxyParams.ProxyServer:=Edit4.text;
Form1.IdHTTP1.ProxyParams.ProxyUsername:=Edit5.text;
Form1.IdHTTP1.ProxyParams.ProxyPassword:=Edit6.text;
if CheckBox1.Checked=true Then
Form1.IdHTTP1.ProxyParams.BasicAuthentication:=True
else Form1.IdHTTP1.ProxyParams.BasicAuthentication:=False;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
Edit3.text:= Inttostr(Form1.IdHTTP1.ProxyParams.ProxyPort);
Edit4.text:=Form1.IdHTTP1.ProxyParams.ProxyServer;
Edit5.text:=Form1.IdHTTP1.ProxyParams.ProxyUsername;
Edit6.text:=Form1.IdHTTP1.ProxyParams.ProxyPassword;
if Form1.IdHTTP1.ProxyParams.BasicAuthentication=True Then
CheckBox1.Checked:=true
else CheckBox1.Checked:=False;
end;

procedure TForm2.Button2Click(Sender: TObject);
begin

end;

end.

2600 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений