Leser: 2
|< 1 2 >| | 13 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#!/usr/bin/perl use HTTP::Daemon; use HTTP::Status; use strict; my $My_IP = 'localhost'; my $Name = "HTTP Server"; my $d = HTTP::Daemon->new( LocalHost => $My_IP, LocalPort => 3003, ); die "$Name: Socket konnte nicht erstellt werden - Grund: $!\n" unless $d; print " $Name läuft auf : <", $d->url, ">\n"; while (my $c = $d->accept) { while (my $r = $c->get_request) { if ($r->method eq 'GET') { my $rs = new HTTP::Response(RC_OK); $rs->content("<HTML>"); $rs->add_content("<HEAD> <TITLE> Anzeige </TITLE> </HEAD>"); $rs->add_content("<BODY>"); $rs->add_content("Nr: <input name=Nummer size 30> ID: <input name=Zuordnung size 30> "); $rs->add_content("<input type=submit value=Zuweisen> <input type=submit value=Löschen> </form> <hr>"); $rs->add_content("</BODY> </HTML>"); $c->send_response($rs); } else { $c->send_error(RC_FORBIDDEN) } } $c->close; undef($c); }
QuoteHTTP::Daemon$c->get_request
$c->get_request( $headers_only )
This method reads data from the client and turns it into an HTTP::Request object which is returned.
1
2
3
4
elsif ($r->method eq 'POST') {
#print STDERR $r->as_string;
print STDERR $r->content;
}
1
2
3
4
5
6
21: $rs->content("<HTML>");
22: $rs->add_content("<HEAD> <TITLE> Anzeige </TITLE> </HEAD>");
23: $rs->add_content("<BODY>");
24: $rs->add_content("Nr: <input name=Nummer size 30> ID: <input name=Zuordnung size 30> ");
25: $rs->add_content("<input type=submit value=Zuweisen> <input type=submit value=Löschen> </form> <hr>");
26: $rs->add_content("</BODY> </HTML>");
1
2
3
4
5
6
7
06: use CGI;
21:
22: $rs->content(CGI::start_html(-title=>' Anzeige '));
23: $rs->add_content(CGI::start_form);
24: $rs->add_content("Nr: " . CGI::textfield(-name=>'Nummer', -size=>30) . "ID: " . CGI::textfield(-name=>'Zuordnung', -size=>30);
25: $rs->add_content(CGI::submit(-value=>'Zuweisen') . CGI::submit(-value=>'Löschen') );
26: $rs->add_content(CGI::end_form . CGI::hr . CGI::end_html);
|< 1 2 >| | 13 Einträge, 2 Seiten |