Skip to content

Instantly share code, notes, and snippets.

@Su-Shee
Created November 25, 2014 16:41
Show Gist options
  • Save Su-Shee/f5a7e4a867531bd3ff42 to your computer and use it in GitHub Desktop.
Save Su-Shee/f5a7e4a867531bd3ff42 to your computer and use it in GitHub Desktop.
usage of curl module
!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use WWW::Curl::Easy;
my $curl = WWW::Curl::Easy->new;
$curl->setopt(CURLOPT_URL, 'http://localhost:3000');
my $response_body;
$curl->setopt(CURLOPT_WRITEDATA,\$response_body);
my $retcode = $curl->perform;
my $foo = $curl->getinfo(CURLINFO_HTTP_CODE);
my $bla = $curl->getinfo(CURLINFO_NAMELOOKUP_TIME);
my $meh = $curl->getinfo(CURLINFO_CONNECT_TIME);
say $foo;
say $bla;
say $meh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment