Link to home
Create AccountLog in
Avatar of Mark
Mark

asked on

Put query string from URL request - PERL HTTP Daemon

I want to be able to call for example:

127.0.0.1:8000/?abc=123

And get the value of 'abc' printed to the console..



##!/usr/bin/perl

use HTTP::Daemon;
use Data::Dumper;

my $d = HTTP::Daemon->new(
    LocalPort => 8000
) || die;

while (my $c = $d->accept) {
    while (my $request = $c->get_request) {
		
print $request->url->path();

        my $response = HTTP::Response->new( 200, 'OK');
        $response->header('Content-Type' => 'text/html'),
        $response->content("Ack");
        $c->send_response($response);
		$c->close;
		exit;
    }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mark Olsen
Mark Olsen
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Mark
Mark

ASKER

Thank you