From 494f069b6015133fb18b9ebb41a6e9beef090736 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sat, 6 Jun 2015 23:36:37 +1200 Subject: Switched from curl to HTTP::Tiny --- README.md | 12 +----------- svgcaptcha-parser | 6 +++--- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 79e63a2..8b31eab 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,6 @@ This targets a very small subset of all possible types of SVG captchas. Dependencies ------------ -* curl +* HTTP::Tiny * XML::Simple -Invocation ----------- -Example: - - $ ./svgcaptcha-parser - Saved 3f45kx9.svg - $ ls *.svg - 3f45kx9.svg - $ - diff --git a/svgcaptcha-parser b/svgcaptcha-parser index af98720..fd65c8d 100755 --- a/svgcaptcha-parser +++ b/svgcaptcha-parser @@ -4,11 +4,11 @@ use strict; use warnings; use XML::Simple; - +use HTTP::Tiny; # Fetch fresh svg and parse it -die("Failed to download new svg: $!\n") unless my $raw_svg = `curl -s http://svgcaptcha.com/captcha.php`; - +my $response = HTTP::Tiny->new->get('http://svgcaptcha.com/captcha.php') or die("Failed to download new SVG: $!\n"); +my $raw_svg = $response->{content}; my $svg = XMLin($raw_svg, KeyAttr => {"text", "x"})->{"text"}; -- cgit v1.1