By using the radio occultation method, we can measure the electron densities in planetary ionospheres. The feasibilities to measure the Martian nightside ionosphere and lunar ionosphere are discussed. The frequencies of two coherent radio waves transmitted from the spacecraft to the Earth are perturbed when the rays pass through the planetary ionosphere. The electron density profile will be derived from the frequency perturbation. It is revealed that the effect of the perturbation of the terrestrial ionosphere on the measurement of the Martian nightside ionosphere and lunar ionosphere is not negligible.