Sergio_Werner is experiencing issues with sending invites via the Discourse API. Despite following the correct API call, the request is not returning a response.
blake shared a working PHP example for sending invites via the API, using curl to make the request.
After further investigation, Sergio_Werner discovered that the API call works directly via curl but not through PHP.
Falco suggested that the issue might be due to the PHP code not following redirects, while riking recommended enabling redirects using easy_setopt.
The exact solution has not been found yet, but it appears to be related to how the PHP code handles redirects.
We are happy to help but there could be an infinite list of things that is causing your issue and we need a little bit more info in order to help out in any way.
As an example of one of the things that could go wrong is that you might not have the curl php module installed or enabled on your computer.
In order to rule out any API/internet issues I would start with just using curl directly from the command line and not use php and see if you can get it to work. There are two example api calls in the docs that require authentication that you should start out with:
curl -X GET "http://127.0.0.1:3000/admin/users/list/active.json?api_key=714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19&api_username=discourse1"