You can use Chrome's Inspector, while opening the page. In the Network tab you can see the requests done against your server, and each of them can be reproduced with Curl commands if you choose 'Copy as Curl' from the right click menu. Paste those commands into a shell script and it should work, basically you just reproduce the HTTP calls done by your browser including basic authentication, since the data you input is eventually POSTed. The problem is you have to manually implement all the calls your browser does, and you have no automated redirects handling.
If you really want to do it like a browser would do, you can programmatically emulate a browser inserting data into the text field filtered by IDs, just like a real browser would do. For this you can use something like watir or PhantomJS but that is real code written in a programming language, running against a full fledged browser engine, not just a bunch of simple curl calls in a shell script.