I have a node server that hosts 3 different apis, then I run separate server for different applications that communicate to the node server. I seem to get undefined/empty string when trying to curl to the node servers. They work fine with posting from a rEST Console or PostMan, which are apps in Google Chrome. But when I try to cURL from a command line or from PHP, it does not work.
I have tried several different things from the cURL call. I am wondering why this won't work. And what can I do on the server end or on my client end to fix it.
Thanks.
EX cURL call:
$host = 'http://api.codelabs.io:2403/products';
$json = '{"name":"Wine type 2"}';
$ch = curl_init($host);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_PORT, 2403);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$data = curl_exec($ch);