Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark
Mark

ASKER

Thank you