Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   http request (https://www.delphipraxis.net/174745-http-request.html)

Alterauge 7. Mai 2013 14:18

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;

Der schöne Günther 7. Mai 2013 14:23

AW: http request
 
Absicht, dass die Leerstelle zwischen 'hallo' und 'Content-Type' fehlt?

Bummi 7. Mai 2013 14:26

AW: http request
 
Was ist Client und warum sollte etwas gesendet werden.
Du setzt den Host und befüllst 2 Stringvariablen ....

Alterauge 7. Mai 2013 14:37

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;

taveuni 7. Mai 2013 14:39

AW: http request
 
Willst Du uns vergackeiern? Was ist Client, nl, und request. Wo sendest Du was?

mjustin 7. Mai 2013 14:44

AW: http request
 
Zitat:

Zitat von Alterauge (Beitrag 1214557)
so hier ist der neue quelltext, der nicht geht?
warum ?

Gibt es eine Fehlermeldung, und wenn ja, welche?

Alterauge 7. Mai 2013 14:46

AW: http request
 
Oh, habe ich vergessen!

Client ist eine IdTCPClient Komponente!

Sorry :-)

baumina 7. Mai 2013 14:48

AW: http request
 
Und wann teilst du dem Client den Request mit?

Alterauge 7. Mai 2013 14:53

AW: http request
 
wenn der button ausgeführt wird, kommt die fehlermeldung:

'Connection Closed Gracefully'

der compilier gibt keine fehlermeldung raus!

Alterauge 7. Mai 2013 14:57

AW: http request
 
oh, habe was vom quelltext nicht mit angegeben!

sorry!

Delphi-Quellcode:
 // 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);
verstehe es nicht? wieso da nix raus geht!
die fehlermeldung: 'connection Closed Gracefully' verstehe ich auch nicht??


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:14 Uhr.
Seite 1 von 2  1 2      

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