One more thing I think I should mention. The medication that Gnip mentioned, Naltrexone, that's the same thing as Vivitrol in pill form. Vivitrol is a monthly injection of the drug. I figured you had heard of it already. I shouldn't make assumptions. So here's some information about the kinds of treatments for opiate addiction and withdrawls.
First, Naltrexone/Vivitrol. This medication blocks the receptors that receive the opiates. You can injest or inject the opiate, you can still overdose and die from it, but you wont get high from it. If there is even a tiny bit of an opiate in your system when you first take Naltrexone/Vivitrol you're going to have the worst withdrawls you have ever had in your life. You need to have already gone through opiate withdrawls completely before taking this medication. Any doctor worth anything is going to test you for opiates before giving you this drug, however, I have talked to people who were coming off of some of these newer fentanyl coctails they are selling on the streets in the United States that didn't show up on the typical drug tests they were using for some reason. They ended up having a real bad time for a long time. You'll most likely know when you're through with the withdrawls.
Next, Suboxone/Subutex. Suboxone is a synthetic opiate used to treat the withdrawl symptoms themselves. It also has a kind of blocker that stops the effects of opiates but it doesn't work as well as the Vivitrol. Suboxone comes in these little orange strips that are placed under the tongue to dissolve. They taste awful, but they work. Subutex is a similar drug in pill form, it's not ideal but that's what they give to pregnant women. I'm not entirely sure of the difference because Subutex isn't nearly as common and I've had no experience with it.
Some things to know about Suboxone. First, and most importantly, Suboxone must be taken after withdrawl symptoms have started. Roughly 24 hours after the last dose of heroin or pain killers or whatever. Definately not before 18 hours. These numbers I'm giving you are not conservative. They are the bare minimum. If it isn't taken this way, you'll go into rapid detox and you're gonna have a real bad time. Second, also probably equally important, Suboxone is a synthetic opiate. That means it's still an opiate. Coming off of suboxone is not fun either. I've heard doctors say that if coming off heroin is 100% withdrawls then coming off of Suboxone is 70%. How I did it, personally, is different than how a lot of people do. I used two strips of Suboxone cut in to peices over the course of a week or two. Typically someone prescribed Suboxone takes a whole strip every day. I used the Suboxone to take some of the edge off of the withdrawls, but didn't use it long enough to get all that dependent on the Suboxone. I should say again that when I went into rehab I wasn't feeling great but I had dodged the worst of it for sure.
Lastly, Methadone. Stay away from this shit. Methadone is also a synthetic opiate and the withdrawls are absolutely the worst. There's a reason opiate users and addicts call Methadone users "lifers". They are typically hooked for life. Most places don't like to give out Methadone anymore for this reason. This shit is bad. You should be afraid of it.
Now if you manage to get past the withdrawls you're going to find yourself pretty lost mentally and emotionally. I go to 12 step meetings. Think of them as a guide to a way of life that is more healthy and balanced. Learning and adopting the philosophies laid out in their books and doing the work described in them has helped me more than anything else. Substance Abuse Disorder is a mental illness. 12 step meetings treat it.
I hope this information helps anyone who's trying to kick the habit.