cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Help iterating through post data

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 13 May 2004 15:41:23 +0200 (CEST)

On Thu, 13 May 2004 mconnor_at_reisonline.com wrote:

> I need to rotate through the alphabet on the post data. I want to send
> 456976 (26*26*26*26) web requests to the URL

Using [] in the POST data will not create ranges the way you want to.

I would write it up using perl:

foreach $l1 ('a' .. 'z') {
    foreach $l2 ('a' .. 'z') {
        foreach $l3 ('a' .. 'z') {
            foreach $l4 ('a' .. 'z') {
                system("curl yadayadaa...?moo=$l1$l2$l3$l4");
            }
        }
    }
}

Or if you prefer a one-liner:

map {$a=$_; map {$b=$_; map {$c=$_; map { system("curl yada?moo=$c$b$a$_");} \
('a' .. 'z')} ('a' .. 'z')} ('a' .. 'z');} ('a' .. 'z');

I'm sure your favourite language also has a way of doing it.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-05-13