One way players obtain a Magmar in Pokémon Pearl is by using an Action Replay.
Alternatively, you can catch a Magby and evolve it, or trade for a Magmar, both of which are legitimate in-game methods that don't require a cheat device.