Answer the question
In order to leave comments, you need to log in
How to send request via curl php to localhost?
Hello.
I have a problem with sending request to centrifuge api with php. https://centrifugal.github.io/centrifugo/
I have docker compose, centrifuge works correctly.
But when I send a curl request from php to localhost, I get an error
Could not connect to port 80 localhost after 10ms: connection refused
That is, I make a request to my localhost, but php knows nothing about it at all.
How to fix it?
Answer the question
In order to leave comments, you need to log in
localhost in the container, hence the error.
The option is so-so, but the working one is to configure the service that runs on the host machine so that it listens on all IPs (perhaps this has already been done) and access it from the container using the gateway IP (it is available both from the host machine and from the container). The gateway IP is the one assigned to the docker bridge, you can find out with the command:
docker inspect --format='{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' <container_name>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question