devilbox icon indicating copy to clipboard operation
devilbox copied to clipboard

[Howto]: Communicate between 2 projects from php container

Open TheoD02 opened this issue 2 years ago • 3 comments

Have you already checked elsewhere?

What are you struggling with?

Hello,

My problem is related to the connection of 2 projects that must communicate with each other.

2 projects are reachable from host, but not from container

What is your goal?

I would like to make 2 projects communicate with each other,

So I have my project folder which contains my project A & B.

My project A needs to call the api of project B to get information.

I use the guzzle client in project A so I call the api with the following url as I would in postman for example "b.loc/api/endpoint" this works fine on the postman side, but how do I do it in the container?

Currently, it returns me the "localhost" dashboard page of devilbox

TheoD02 avatar Aug 22 '22 12:08 TheoD02

This should work by default. Is bind running? Also, can you do a curl at both of your API's from within the PHP container.

cytopia avatar Aug 22 '22 12:08 cytopia

This should work by default. Is bind running? Also, can you do a curl at both of your API's from within the PHP container.

Hey thanks for reponse,

The bind container running fine.

Calling my API from PHP ⇒ return devilbox dashboard Calling my API from PHP container with curl ⇒ working, get expected response

TheoD02 avatar Aug 22 '22 14:08 TheoD02

Calling my API from PHP ⇒ return devilbox dashboard

Can you share the code snippet that is calling the API

cytopia avatar Aug 22 '22 16:08 cytopia

@TheoD02 This works perfectly fine from inside the container. I assume that this has been resolved as the requested information has not been provided.

cytopia avatar Dec 04 '22 10:12 cytopia