Как сделать отправку из Списка на сервер
Код на дельфи
Добавлено:
Это должно выглядить как то так
Код:
Func _TwoWindow()
local $Form7, $Group7, $Group8, $Group9, $Edit7,$Edit9, $Input8, $Button7, $Button8, $Button9
$Form7 = GUICreate("Качаем бицуху", 625, 445, 192, 124)
$Group7 = GUICtrlCreateGroup("Список", 8, 8, 297, 425)
$Edit7 = GUICtrlCreateEdit("", 16, 24, 273, 369)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button7 = GUICtrlCreateButton("Извлеч из ...", 16, 400, 105, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group8 = GUICtrlCreateGroup("Пользователь", 328, 8, 281, 49)
$Input8 = GUICtrlCreateInput("", 344, 24, 249, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group9 = GUICtrlCreateGroup("Информация", 328, 72, 281, 305)
$Edit9 = GUICtrlCreateEdit("", 336, 88, 257, 281)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button8 = GUICtrlCreateButton("Получить", 328, 400, 129, 33, $WS_GROUP)
$Button9 = GUICtrlCreateButton("Закрыть", 480, 400, 129, 33, $WS_GROUP)
$sexit = GUICtrlDelete($Form7)
GUISetState(@SW_SHOW)
While 1
$smsg = GUIGetMsg();
Switch $smsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form7)
ExitLoop
EndSwitch
Switch $smsg
Case $Button7
$text = FileOpenDialog("Указать файл", @WorkingDir & "", "Любой (*.txt)", 1 + 4 )
$Read = FileRead($text)
GUICtrlSetData($Edit7, $Read)
EndSwitch
Switch $smsg = $Button9
Case $GUI_EVENT_CLOSE
GUIDelete($Form7)
ExitLoop
EndSwitch
WEnd
EndFunc
Код на дельфи
var
Form1: TForm1;
tst: TStringList;
implementation
{$R *.DFM}
procedure TNewThread.Execute;
var
i,j:integer;
s,t:string;
begin
for i:= 0 to Form1.memo1.Lines.Count - 1 do
begin
s:=Form1.Memo1.Lines;
j:=Pos(':', s);
try
tst := TStringList.Create;
tst.Add('model_id=1');
tst.Add('friend_uid='+form1.Edit1.Text);
tst.Add('user='+Copy(s, 1, j-1));
tst.Add('vote=5');
tst.Add('key='+copy(s,ansipos(':',s)+1,length(s)));
tst.Add('method=voteForFriend');
t:=Form1.idHTTP1.Post('http://109.234.155.196/prison/universal.php?voteForFriend',tst);
if pos('success vote',t)<>0 then begin
Form1.Memo2.Lines.Add('Ïîçâàí ñ id='+Copy(s, 1, j-1)+' ');
end;
if pos('<code>1</code>',t)<>0 then begin
Form1.Memo2.Lines.Add('Íå óäàëîñü ñ id='+Copy(s, 1, j-1)+' :(');
end;
if pos('<result>0</result>',t)<>0 then begin
Form1.Memo2.Lines.Add('Îøèáêà ïðîâåðòå ïðàâèëüíîñòü id:auth');
end;
except on e : EIDHttpProtocolException do
Begin
if e.ReplyErrorCode = 500 then
Form1.Memo2.Lines.Add('500 Internal Server Error');
end;
end;
end;
end;
Form1: TForm1;
tst: TStringList;
implementation
{$R *.DFM}
procedure TNewThread.Execute;
var
i,j:integer;
s,t:string;
begin
for i:= 0 to Form1.memo1.Lines.Count - 1 do
begin
s:=Form1.Memo1.Lines;
j:=Pos(':', s);
try
tst := TStringList.Create;
tst.Add('model_id=1');
tst.Add('friend_uid='+form1.Edit1.Text);
tst.Add('user='+Copy(s, 1, j-1));
tst.Add('vote=5');
tst.Add('key='+copy(s,ansipos(':',s)+1,length(s)));
tst.Add('method=voteForFriend');
t:=Form1.idHTTP1.Post('http://109.234.155.196/prison/universal.php?voteForFriend',tst);
if pos('success vote',t)<>0 then begin
Form1.Memo2.Lines.Add('Ïîçâàí ñ id='+Copy(s, 1, j-1)+' ');
end;
if pos('<code>1</code>',t)<>0 then begin
Form1.Memo2.Lines.Add('Íå óäàëîñü ñ id='+Copy(s, 1, j-1)+' :(');
end;
if pos('<result>0</result>',t)<>0 then begin
Form1.Memo2.Lines.Add('Îøèáêà ïðîâåðòå ïðàâèëüíîñòü id:auth');
end;
except on e : EIDHttpProtocolException do
Begin
if e.ReplyErrorCode = 500 then
Form1.Memo2.Lines.Add('500 Internal Server Error');
end;
end;
end;
end;
Добавлено:
Сообщение автоматически объединено:
Это должно выглядить как то так
Код:
local $response
$PostData = 'user=' & $sUser & '&sig=9657510905665054df4c085a1b359445&key=' & $sAuth & '&method=voteForFriend' ; позвать в качалку
$oHTTP.Open('POST', $GetStr)
$oHTTP.setTimeouts(5000, 5000, 10000, 10000)
$oHTTP.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
$oHTTP.Send($PostData)
$oHTTP.WaitForResponse
$Response = $oHTTP.ResponseText