Yes..it's possible to unlock your iPhone 3GS via online.Before that you have to jailbreak.
There are many software's available to jailbreak your iPhone.After this you can unlock your mobile.This unlocking can be done by remote unlocking method. This is the safe and easy way of unlocking .If you need get the unlocking service from Ihav.net .This is the online service provider which offer the service for your mobile.With the help of this you can unlock your mobile easily.