You can use functions $\phi \in C_\mathrm{c}^\infty (\mathbb{R}^2)$ of the form $\phi(x,y) = \chi(x) \psi(y)$ with $\chi, \psi \in C_\mathrm{c}^\infty (\mathbb{R})$ .
Since all functions are sufficiently nice, Fubini's theorem applies and we can conclude that
$$ \int \limits_\mathbb{R} \psi(y) \int \limits_\mathbb{R} f(x,y) \chi' (x) \, \mathrm{d} x \, \mathrm{d} y = 0 $$
holds for every $\psi \in C_\mathrm{c}^\infty (\mathbb{R})$ . Thus the continuous function $y \mapsto \int_\mathbb{R} f(x,y) \chi'(x) \, \mathrm{d} x $ vanishes identically for every $\chi \in C_\mathrm{c}^\infty (\mathbb{R})$ by the fundamental theorem of the calculus of variations.
But then for fixed $y \in \mathbb{R}$ the function $x \mapsto f(x,y)$ must be constant (see for example this question) and equal to $c(y)$, say.
Since $f$ is continuous, we have $f(x,y) = c(y)$ for every $(x,y) \in \mathbb{R}^2$ with $c \in C^0 (\mathbb{R})$ .