now browsing by category


CURL response is empty; API server running on Docker container

My API endpoint (for example http://localhost:3000) server running on Docker container. Initiated curl session in PHP (vagrant box) and the response was empty. Here is the code sample without proxy.

I then read docker networking docs and solved my problem setting docker ip as curl proxy. Here are the steps:

Step 1: Find your docker ip
1. Find your container ID:

2. Grab your docker ip by container ID:

Here is the final PHP code example: