The Ethereum VM only supports IO to/from the blockchain. To address this, there are things called “oracles” which tap into the external world.
There’s a problem with that, which is they need to be trusted to fetch complete and accurate information. I don’t think this is a solved problem yet. I believe the directional answer is some sort of blockchain reputation system of sources/oracles?