I purchased a used iphone and now I cannot transfer my information to it because it still has the former owner's Apple ID.
This depends on the situation. IF Find My iPhone is on, he'll have to remove it from his account. Otherwise, sign out in iTunes & App Store, iCloud, FaceTime, Messages > Send & Receive, and GameCenter (can all be found in Settings, some may not be signed in). In most of these, you can tap on the AppleID: or Account: field, which shows the email address, while in iCloud, you scroll down to the bottom and look for Sign Out (iOS 8) or Delete Account (7 and earlier) Ideally, as long as Find My iPhone is not turned on, Settings > General > Reset > Erase All Content And Settings, or even more ideally, use iTunes to Restore iPhone.
In summary, when Find My iPhone is NOT turned on, the best way is to use iTunes to restore.
Edit: I just noticed you tagged your question ios-5. If it's not running iOS 7 or newer, you may not need to worry about Find My iPhone. Activation Lock begins with 7. (You can check the version in Settings > General > About if you're unsure.)