The registration code for Spore is printed on the back of the instruction manual. If you bought the game, that's where to find it.
If you downloaded it and there's no manual, then the honest answer is you'll probably need to buy a legitimate copy to get a valid code.