Can I get an Iphone and a 2 year contract plan with bad credit?

My score is 504.

It depends on the phone company. If they say no it's because they believe you are a credit risk ie likely to not pay your monthly bills. You can only try and see!

You earned the bad credit and part of the "punishment" is not being able to do what ever you want any more. You will just have to get over it and work to improve your credit. If you even thought about it you would not want a new bill when you can't pay the ones you have