I need to Curl from a PHP website to a host that's unresolvable from the target machine (curl_error returns (6) couldn't resolve host). It's resolvable just fine on my local machine though, so after some web searching I figured it might be a DNS caching issue.
I only have FTP access to this webserver, so I can't restart Apache or edit the r.conf file.
I tried Curling using the IP address I got from pinging the domain, but unfortunately I need to make requests to a subdomain (e.g., api.domain.com), and requests to the IP address directly get handled differently.
I had hoped I could specify the subdomain+domain in the Host header (see below), but this doesn't work either.
$curl = curl_init();
$opt = array(
CURLOPT_URL => 'http://11.22.33.44/handler.php?params=1',
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => array('Host: subdomain.domain.com')
);
curl_setopt_array($curl, $opt);
$output = curl_exec($curl);