How do astronomers measure the temperature of the Sun without going there?
The spectrum of the Sun has the shape of a so-called black body, which means the radiation that its surface emits follows a specific profile at different frequencies. Through physics, this is uniquely related to the temperature of the surface emitting the light ‘in thermal equilibrium’, and when you account for the presence of absorption lines, you end up with an estimated temperature near 5750 K give or take about 50 K.