All pastes #977209 Raw Edit

Something

public text v1 · immutable
·published 2008-04-08 18:19 UTC
rendered paste body
sub http_get {
    my $url = shift() || die('http_get() missing argument');

    debug("HTTP GET: $url");

    my $req = HTTP::Request->new(GET => $url);
    $req->header(Accept => "text/html, */*;q=0.1");
    my $res = $ua->request($req);

    debug("HTTP GET Request sent");

    # Check the outcome of the response
    if ($res->is_success) {
        # http_print_result($res->content);
        return $res->content;
    }

    return $res->status_line;
}