This is a write-up of the lectures given in Young Researchers Integrability School 2017. The main goal is to explain the connection between the ODE/IM correspondence and the classical integrability of strings in AdS. As a warm up, we first discuss the classical three-point function of the Liouville theory. The starting point is the well-known fact that the classical solutions to the Liouville equation can be constructed by solving a Schrodinger-like differential equation. We then convert it into a set of functional equations using a method similar to the ODE/IM correspondence. The classical three-point functions can be computed directly from these functional equations, and the result matches with the classical limit of the celebrated DOZZ formula. We then discuss the semi-classical three-point function of strings in AdS2 and show that one can apply a similar idea by making use of the classical integrability of the string sigma model on AdS2. The result is given in terms of the massive generalization of Gamma functions, which show up also in string theory on pp-wave backgrounds and the twistorial generalization of topological string.