I must admit that I hesitated answering this question, but here it is.
IdentifyingThe answer is "no". Assume there exist topological spaces $X$ and $Y$ such that $C(X,Y)\simeq \mathbb{R}$ and $Y\not\simeq\mathbb{R}$. Identifying $C(X,Y)$ with $\mathbb{R}$ and $Y$ with the constant functions in $Y^X$ we consider $Y$ as a closed subsapce of $\mathbb{R}$. Considering the surjection $\mathbb{R} \to C(X,Y)\to C(\{x\},Y) \simeq Y$$\mathbb{R} \to C(X,Y)\to C(\{x\},Y) \to Y$, we see that $Y$ is connected. WLOG we have Thus $0,1\in Y$ and 1$Y\subset\mathbb{R}$ is a closed convex subset. As $Y\not\simeq \mathbb{R}$ there must exist an endextreme point $y\in Y$. considering the constant functions $0,1\in C(X,Y)$, I claimNote that $C(X,Y)-\{1\}$ could be contracted to $\{0\}$. For this, consider the contraction$C(X,Y)$ is a convex subset of $Y$ to $0$ given by $c:Y\times [0,1]\to Y$, $(y,t) \mapsto (1-t)y$$C(X,\mathbb{R})$ and obtain the contractionconstant function $C(X,Y)\times [0,1] \to C(X,Y)$ given by postcomposition:$y$ is an extreme point of it. It follows that $(\phi,t)\mapsto [x \mapsto c(\phi(x),t)]$$C(X,Y)-\{y\}$ is also convex, hence contractible. We thus get a contraction ofBut $\mathbb{R}-\{1\}$$C(X,Y)-\{y\}$ is homeomorphic to 0,$\mathbb{R}$ minus a point. This is a contradiction.