Is it haram to have a online girlfriend?
Yes, indeed having a girlfriend/boyfriend is haram. The reason being the Quran and hadiths making it clear that it is forbidden and leads to bad effects. You lose kushoo in your Salah and focus all your time on futility and immorality with this girl who is haram for you.
Is it OK to have a girlfriend in Islam?
They have religious restrictions that limit physical contact in premarital relationships. Dating is still linked to its Western origins, which implies underlying expectations of sexual interactions — if not an outright premarital sexual relationship — which Islamic texts prohibit. But Islam does not forbid love.