![]() |
FRITZ!Box neu anmelden
Hallo,
um meine FRITZ!Box abzumelden und mir anschließend eine neue IP-Adresse zu beschaffen verwende ich folgendes Script im Zusammenhang mit curl:
Code:
Dies funktioniert auch wunderbar, allerdings würde ich das gerne in ein eigenes Programm integrieren ohne curl zu verwenden.
curl "http://fritz.box:49000/upnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#ForceTermination" -d "<?xml version='1.0' encoding='utf-8'?> <s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <u:ForceTermination xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>"
Ich habe es mit IdHTTP versucht, aber habe es nicht hinbekommen. Hat jemand eine Idee wie es funktionieren könnte? Danke |
Re: FRITZ!Box neu anmelden
Hier ist die Lösung:
Delphi-Quellcode:
procedure FBdisconnect;
var sock: TTcpClient; buffer: AnsiString; begin sock := TTcpClient.Create(nil); sock.RemoteHost := 'fritz.box'; sock.RemotePort := '49000'; sock.Open; buffer := 'POST /upnp/control/WANIPConn1 HTTP/1.1'+#13+#10+ 'Host: fritz.box:49000'+#13+#10+ 'Accept: */*'+#13+#10+ 'Content-Type: text/xml; charset=utf-8'+#13+#10+ 'SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#ForceTermination'+#13+#10+ 'Content-Length: 276'+#13+#10+ ''+#13+#10+ '<?xml version=''1.0'' encoding=''utf-8''?> <s:Envelope s:encodingStyle=''http://schemas.xmlsoap.org/soap/encoding/'' xmlns:s=''http://schemas.xmlsoap.org/soap/envelope/''> '+ '<s:Body> <u:ForceTermination xmlns:u=''urn:schemas-upnp-org:service:WANIPConnection:1'' /> </s:Body> </s:Envelope>'; sock.SendBuf(buffer[1],length(buffer)); sock.Close; sock.Free; end; |
Re: FRITZ!Box neu anmelden
Könntest Du bitte beim nächsten Mal Crossposts in verschiedenen Foren kenntlich machen (einfach das jeweilige Gegenstück im anderen Forum verlinken)?
|
Re: FRITZ!Box neu anmelden
Zitat:
sind diese Fritz!Box-Kommandos (SOAP Actions) eigentlich irgendwo dokumentiert? Ich habe schon gesucht aber bisher nichts brauchbares gefunden. Danke schon mal, Ralf |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:32 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