# Ephemeris data usage in interplanetary trajectory application

I'm trying to write a Mathematica application that allows users to choose their date of departure and time-of-flight for an interplanetary transfer mission (currently only working for Earth-Mars transfers), which is then animated (similar to NASA's trajectory browser except not as cool).

So far I've managed to get the Lambert solver and 3-body Sun-Earth-Mars numerical model working, but now I need to figure out how to get ephemeris data automatically from JPL's Horizons ephemeris when a user selects their departure date and TOF. I thought about trying to incorporate the Horizons telnet service into the application, but it might be quite tough to get that working, and the position and velocity data that is given doesn't seem to be in a Mathematica friendly format which might require lots of string matching/replacing.

Another alternative would be to somehow download and tabulate years worth of ephemeris data into a spreadsheet and extract it from there upon request, but this also seems like a laborious task. My question is therefore this:

How do normal trajectory planners/plotters get their ephemeris data?

There are many, many functions in the toolkit, but you'll only need a handful. For example, you can use furnsh_c() to load the ephemeris file and the leap seconds file, and spkezr_c() to get the position and velocity of the specified body at the specified time, in the specified reference frame.