I have made a php script inside localhost and I am connecting that with httpClient
but I am getting a problem.
Please tell me how can I connect to a php file at localhost from the emulator?
10.0.2.2
to access your actual machine.As you've learned, when you use the emulator, localhost
(127.0.0.1
) refers to the device's own loopback service, not the one on your machine as you may expect.
You can use 10.0.2.2 to access your actual machine, it is an alias set up to help in development.