Run a script to log in to WiFi upon connect
There’s nothing that allows you to kick off a script when you attach to a particular network, so you’ll have to use two tools


launchctl  You’ll have to start the job based on network availability.  Unfortunately, this only checks to see if you’re connected to any network, not a specific one.
networksetup that gets the current SSID you’re attached to.  The command you will need is 

networksetup -listpreferredwirelessnetworks en1 | grep ${SSID} | cut -f2



Then in a bash script, compare the output of that command and if it matches the SSID you want, run the curl command.