When communicating on the Internet, have time to get to know each other better. It is unlikely that a girl will give her number to a stranger.
It is harder to gain trust on the Internet than in real life, so do not rush to change numbers until the girl is ready for this.
If you contact in real life, the best way is to just ask her what her phone number is. You should not invent some kind of fraud and by deception get her phone number. She's unlikely to like it if suddenly she doesn't like you. Just ask for a phone number and she will be happy to share it with you if she is into you.
Before taking a number, make sure she is interested in you, and if this is your first approach on the street and you are in a hurry, then take at least a minute to chat with her.
She will see that you are adequate and will most likely give you her number.