Brokers buy and sell stocks through an exchange, charging a commission to do so. A broker is simply a person who is licensed to trade stocks through the exchange. A broker can be on the trading floor or can make trades by phone or electronically. An exchange is like a warehouse in which people buy and sell stocks.
When you buy and sell stocks online, you're using an online broker that largely takes the place of a human broker. You still use real money, but instead of talking to someone about investments, you decide which stocks to buy and sell, and you request your trades yourself. Some online brokerages offer advice from live brokers and broker-assisted trades as part of their service.