I cant code myself :-\
In my limited knowledge, you would use PHP as the scripting language, I would guess you would also need to view the source of the portal page you need to authenticate against and look for any references to
<form>with attributes for username & password etc, you would then use this information in your custom.php file to submit the required data.
look here for how you can use PHP functions http://www.w3schools.com/php/php_post.asp
If you think thats way over your head then I would suggest you contact a developer with a bounty as this is a pfsense customisation or just post the request in the bounty section of the forum.
Bear in mind, that your wireless provider might employ timeouts, in which case your opt2 will be marked/shown as being offline in your multi wan envoirment.
Hope that helps
Slam
</form>