We have a ZeroTier VPN network for accessing an API installed in local machine. When I try to connect using cURL everythings works in localhost, but connection was refused from live server.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://XXX.XXX.XXX.XXX:8088/api/person/get/7576?access_token=XXXXXX",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_USERAGENT=>'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'
));
if (curl_exec($curl) === FALSE) {
die("Curl Failed: " . curl_error($curl));
} else {
$response = curl_exec($curl);
}
curl_close($curl);
var_dump ($response);
This code works with "localhost" but fails with IP number. cURLs is enabled in the hosting control panel.
Some suggestion???