The headphone socket will work, but there's a chance you may suffer distortion, it requires quite a high level to drive headphones.
To get true line level input, get a two x phono plug (RCA plug) to 3.5mm stereo jack plug lead and take the audio out from the CD player to the line in of your sound card/on board sound.
This is a rather nifty way to beat them 'protected' CD's, btw, but you will only create an analogue recording.