I am trying to make a cURL call to a url that looks like this:
https://example.com:9000/test
When I execute the following code, I get curl error 7 couldn't connect to host.
$headers = array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 10,
CURLOPT_URL => 'https://example.com:9000/test',
);
$headers[CURLOPT_SSL_VERIFYPEER] = FALSE;
$headers[CURLOPT_SSL_VERIFYHOST] = 2;
$ch = curl_init();
curl_setopt_array($ch, $headers);
$response = curl_exec($ch);
If I set the url to https://example.com/test
, I am able to connect to the host, just not to what I need to get.
I have also tried setting <code>CURLOPT_PORT => 9000</code>
with the same result (error 7).
One other note, I am able to use cURL with the url on some machines but not others. My Windows machine works fine, but the linux server I'm on is the one having issues. Another linux server seems to work fine as well.
EDIT:
Server is shared hosting on hostgator.com
.