Use curl_getinfo($ch, CURLINFO_PRIMARY_IP) or look in the "primary_ip" key/value of curl_getinfo($ch).
curl_getinfo($ch, CURLINFO_PRIMARY_IP)
"primary_ip"
curl_getinfo($ch)
What's your PHP version? You must be using an old version.