Thema: Delphi FRITZ!Box neu anmelden

Einzelnen Beitrag anzeigen

m.r.m.
(Gast)

n/a Beiträge
 
#2

Re: FRITZ!Box neu anmelden

  Alt 8. Apr 2009, 11:53
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;
  Mit Zitat antworten Zitat