The the problem is probably the standard 3.5mm jack. Smart phones use four pole 3.5mm jacks to add a mic to a headset.
There are two configurations used but the most common (read what Apple pushes) is to have the sleeve as mic in, ground on the adjacent ring, right audio on the next ring then left on the tip.
Pinout with list of phones
I know that most recent Samsung phones reverse ground and mic in. I actually built a small crossover cable to get around this issue.
According to this page the mic should work if the resistance is about 2.2k ohms.
I only assume this works based on the success of using my crossover cable to use a headset/mic with button designed for iPhone on my Galaxy S.
If you intend to use the mic input mic input to your sound card, it will have a current source or pullup resistor to supply a bias to the microphone to which it was intended.
It might not be good for the speaker to have DC flowing through it.
If your phone is connected to the telco, be very careful. The speaker may run at quite a CM voltage and the DC offset might be -48V (depending which way round it is wired).
Telephones wires are very good at attracting lightning. During a storm high common mode voltages may be on the earpiece.
Stricly speaking you should use an audio transformer to couple the earpiece signal into the sound card, this provides DC isolation and some protection against lightning. Adding a TVS across the output of that transformer would be a good idea too.
The ac signal on the earpiece might be quite small. Only a few hundred mV. For a mic input, this will be fine (and can be potted down at the output of your transformer) but for line levels, which are usually 1Vrms it might be very quiet.
Not all phones work the same way, so measure the voltage first using a scope and judge the divsor as required.
The audio transformer should also be protected against DC usign a DC blocking (aka coupling) capacitor.
This circuit protects against discharge and DC currents, though use with caution as a mistake will cost you a PC!
Best Answer
Line levels are 0.5-2.0V range. Mic inputs are expecting millivolts. You just need what is called an L-pad attenuator. Your drop should be 40-50 dB.
If you are using a consumer line level, you will need about 40 dB attenuation. (Professional audio line input would need about 50 dB.)
Attenuation in dB = 20 * log10((R1 + R2) / R2)
Try R1 = 10k and R2 = 100.
If you get accurate measurements of your line source and a know good mic signal for the iPhone, you will be able to calculate more accurate values. Or you can put a 500 ohm trimmer resistor in place of R2 to allow varying of the signal if the line out doesn't have adjustment.