(Bash) Submitting post data to an online form to check username availability

581 views Asked by At

Firstly asked at: (Bash) [email protected] email availability checker (with a well thought out beginning. Thanks again!)

I'm looking to expand on this a bit:

I'm trying to use either Curl, or a simple POST command (neither have proven working yet) to try to validate a list of usernames that I have to the following page:

https://new.aol.com/productsweb/

Essentially, this will be an availability checker for @aol.com email addresses.

It doesn't have to neat, clean, or pretty, as long as it works.

Does anyone have any idea where I can go from here?

1

There are 1 answers

4
Gilles Quénot On

The following bash script using cURL command can check the availability of an email :

testemail=foobar # @aol.com
out=$(
    curl \
        -A "Mozilla/5.0" \
        -L \
        -b /tmp/c \
        -c /tmp/c \
        -s \
        -e 'https://new.aol.com/productsweb/' \
        -d "d=aol.com&f=test&l=test2&m=&s=$testemail" \
        'https://new.aol.com/productsweb/subflows/ScreenNameFlow/AjaxSNAction.do'
)

if [[ $out == *toggleSNField* ]]; then
    echo "email [email protected] is available"
elif [[ $out == *Error* ]]; then
    echo >&2 "an error occured while processing [email protected]"
else
    echo >&2 "[email protected] is unavailable"
fi

EXPLANATIONS

  • to understand what's going on, I use firefox & firebug addon, see XHR tab in this screenshot ²
  • I search in the POST what firefox sends to the AOL server
  • then, I use cURL to do the same

See man curl for further details.

² this is an AJAX request