Cannot access docker container from XAMPP but can access from browser

Hello,
I am a newcomer to docker. I have a docker container which is accessible from Browser at
http://localhost:8080
I can test APIs using Postmanapp also. But when I use PHP cURL from XAMPP (7.2.11-0) it says
cURL Error #:Failed to connect to localhost port 8080: Connection refused

I do not understand why this is happening and how to get things put together. Any kind of help is appreciated.
Thanks.