contaminated food the most common way to get an e. coli infection is by eating contaminated food, such as: ground beef.