Leser: 13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use WWW::Mechanize qw(); # I hate 4 arguments LWP::UserAgent::credentials my $uri = 'urn:dslforum-org:service:DeviceConfig:1'; my $action = 'Reboot'; my $m = WWW::Mechanize->new(timeout => 5); $m->credentials($ENV{FRITZUSER} => $ENV{FRITZPW}); $m->add_header(SoapAction => "$uri#$action"); $m->post( "http://$ENV{FRITZIP}:49000/upnp/control/deviceconfig", content => <<"XML" <?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:$action xmlns:u='$uri'></u:$action> </s:Body> </s:Envelope> XML );