It depends on if it is a sim lock code or a phone lock code. if its a sim lock code simple change the sim or ring the service provider for a puk code and change the password however you do need to know the registration details of the phone such as, name registered to, dob, address, and most important a security question (*e.g mothers maiden name)
if its a phone code you need to purchase a data cable (most shops sell them or you can buy them online). you also need to download some software from the internet which you will find if you look hard enough, however it does vary depending on the phones make and model. so for example if it is a sony ericsson w800i you need to search for software for that model and the program has to be able to read the full phone data such as imei number etc, you can then reflash the phone (factory settings) and there you go. Please note this will not allow you to use different networks sim cards unless the phone is already unlocked to any sim. thanks.
nick m, September 2008