use HTTP::Daemon; use HTTP::Status; use HTTP::Request::Params; # variables my ($host, $port)=('pluto.ifong.org', 8080); my ($dir, $file)=('/dr_haung_2019_device', '/tmp/foo'); my ($f1, $f2)=('tem', 'hum'); # $d mean Daemon my $d = HTTP::Daemon->new( LocalAddr => $host, LocalPort => $port, ) || die; print "Please contact me at: url, ">\n"; #c mean client while (my $c = $d->accept) { while (my $r = $c->get_request) { if ($r->method eq 'GET' and $r->uri->path eq $dir) { $c->send_file_response($file); my $parse_params = HTTP::Request::Params->new({ req => $r, }); my $params = $parse_params->params; print "temperature:$params->{$f1} humidity:$params->{$f2}\n"; } else { $c->send_error(RC_FORBIDDEN) } } $c->close; undef($c); }