Lasers is the answer for everything sci-fi. Truth be told, you could simple use modified solar panels to harvest radiated heat from the planet directly, but that's not the best way to do it. This is where lasers come in. Actually there's more than one way to use lasers to harness the energy of the magma, so I'll give you both and let you decide.
First choice is actually shooting the laser into space, with the laser being powered by some kind of thermal energy converter. You could use a steam engine or thermocouples, your choice. Then, you point the laser at whatever's in space that you can use for energy. You can point the laser at solar panels, which is fine, but require battery cells and stuff and isn't my first choice.
Personally I would fire this laser at a modified Salt Tower that's in space. It can store heat energy to be used as electrical energy later, both more efficiently than storage cells, and with less maintenance. Plus, if the laser needs repairs, you have a reserve of energy to use until the laser is operational again. Also, it doesn't have to use salt, so research if there's anything that may work better for you.
Okay, so those are the ways to use a laser shooting into space, but what if a dense atmosphere blocks the laser, or you want a power source that will last for a long time even away from the planet? Well lucky for you, there's a way to get a lot of energy off the planet in a condensed and usable form.
Turns out, lasers can be used to create nuclear fusion. So far we only really use hydrogen to create helium, but with just slight advances in technology, we could easily create materials such as Uranium, which is useful as a nuclear fuel. Of course, if our fusion is powered by a source of energy that consumes our own resources it won't work, but as far as getting a planet's energy into space, this is a good way to handle it.