Europeans needs resources like rubber from Vietnam, silk, opium, and spices from China. They were able to establish a military presence by establishing trading post when moving into these countries.
It allowed them to establish contact and a military presence in the area. As a result, they could easily take over from weak local rulers when the opportunity arose.