![]() |
http request
hallo, was ist am quelltext falsch?
das telegramm wird nicht gesendet!
Delphi-Quellcode:
procedure TForm1.BitBtn1Click(Sender: TObject);
var request, content : string; begin // http request Client.Host:='192.168.0.110'; request := 'Post /telegramin/alarmgeber/index.xml HTTP/1.1'; content := 'type=pocsag&function=a&address=1234567&flags=0&message=hallo' + 'Content-Type: application/x-www-form-urlencoded' + content; end; |
AW: http request
Absicht, dass die Leerstelle zwischen 'hallo' und 'Content-Type' fehlt?
|
AW: http request
Was ist Client und warum sollte etwas gesendet werden.
Du setzt den Host und befüllst 2 Stringvariablen .... |
AW: http request
so hier ist der neue quelltext, der nicht geht?
warum ? möchte ein telegramm zur schnittstelle senden!
Delphi-Quellcode:
var request, nl, content : string;
// http request content := 'type=pocsag&function=a&address=1234567&flags=0&message=hallo'; if Client.Connected then Client.Disconnect; Client.Connect; nl := AnsiChar(#13) + AnsiChar(#10); request := 'POST /telegramin/alarmgeber/index.xml HTTP/1.1' + nl + 'Authorization: Basic uZtghzjuhZhujHu=' + nl + 'Content-Type: application/x-www-form-urlencoded' + nl + 'Host: 192.168.0.110' + nl + 'Content-Length: ' + IntToStr(length(content)) + nl + 'Expect: 100-continue' + nl + 'Connection: Keep-Alive'+ nl + nl + content; |
AW: http request
Willst Du uns vergackeiern? Was ist Client, nl, und request. Wo sendest Du was?
|
AW: http request
Zitat:
|
AW: http request
Oh, habe ich vergessen!
Client ist eine IdTCPClient Komponente! Sorry :-) |
AW: http request
Und wann teilst du dem Client den Request mit?
|
AW: http request
wenn der button ausgeführt wird, kommt die fehlermeldung:
'Connection Closed Gracefully' der compilier gibt keine fehlermeldung raus! |
AW: http request
oh, habe was vom quelltext nicht mit angegeben!
sorry!
Delphi-Quellcode:
verstehe es nicht? wieso da nix raus geht!
// http request
content := 'type=pocsag&function=a&address=1126026&flags=0&message=hallo'; if Client.Connected then Client.Disconnect; Client.Connect; nl := AnsiChar(#13) + AnsiChar(#10); request := 'POST /telegramin/alarmgeber/index.xml HTTP/1.1' + nl + 'Authorization: Basic jhfhuhjjwerjejghjhewjE=' + nl + 'Content-Type: application/x-www-form-urlencoded' + nl + 'Host: 192.168.0.110' + nl + 'Content-Length: ' + IntToStr(length(content)) + nl + 'Expect: 100-continue' + nl + 'Connection: Keep-Alive'+ nl + nl + content; Client.IOHandler.WriteLn(request); die fehlermeldung: 'connection Closed Gracefully' verstehe ich auch nicht?? |
AW: http request
Hallo,
so jetzt bekomme ich über Button1 mein Telegramm gesendet! ( 1 x mal) Benutze die Indy TCPClient Komponente, ein disconnect ist nicht möglich! (ist ja bekannt bei der Indy Komponente) Was habe ich jetzt noch für eine Möglichkeit, über den Button1 das Telegramm nochmals zu senden?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var request, nl, content : string; i : integer; begin content := 'type=pocsag&address=1234077&flags=0&function=a&message=hallo'; nl := AnsiChar(#13) + AnsiChar(#10); request := 'POST /telegramin/alarmgeber/input.xml HTTP/1.1' + nl + 'Authorization: Basic FtzUjHjUjjJHUJ=' + nl + 'Content-Type: application/x-www-form-urlencoded' + nl + 'Host: delphi.delphi.de' + nl + 'Content-Length: ' + IntToStr(length(content)) + nl + 'Expect: 100-continue' + nl + 'Connection: Keep-Alive'+ nl + nl + content; Client.IOHandler.WriteLn(request); for I := 1 to 20 do Memo1.Lines.Add(Client.IOHandler.ReadLn); end |
AW: http request
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:45 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz