you will have to restore to factory settings
Restore to factory settings means you will lose all of your content. There is no other way.
If you had set up your phone to sync to a contact and calendar app on your computer, or to iCloud, as described in the manual, then those items will still be on your computer or in iCloud and you can sync them back.
If you had copied your pictures to your computer regularly as recommended in the manual they will be on your computer still. Likewise if you had enabled Photo Stream.
If your music and apps were purchased from iTunes then you can redownload them after you restore the phone. Your app data will be lost, however.