Yes, you can connect a real world data in a smart contract. The smart contract can not do it by itself, you need make use third-party service of Oracle. Oraclize is the leading oracle service for smart contracts and blockchain applications, serving thousands of requests every day on Ethereum, Bitcoin and Rootstock.