I can access my test Node site (http://18.220.168.1:8888
) from a browser just fine. However, when I attempt to cURL using PHP's cURL, I get:
Array
(
[curl_error] => Failed to connect to 18.220.168.1 port 8888: Connection refused
[error_number] => 7
)
My cURL setup is:
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Temporary for testing self-signed sites
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: '.$data_type,
'Content-Length: ' . strlen($data),
'Public-Key: ' . $pub_key,
'Private-Key: ' . $priv_key,
'Authorization: Bearer ' . $pub_key,)
);
$result = curl_exec($ch);
I am hosting on Amazon's EC2, and the ports are open (obviously since I can access it via my browser). Any idea what I'm doing wrong here by chance?
Thanks
EDIT
I just tested with resteasy's tester, and it connected just fine. So it has to be something either in the cURL request, or between the browsers.
$url
set to?http://18.220.168.1:8888
. I've tried with and without thehttp://
.