首页 > 代码库 > curl请求指定host ip(指定域名解析的内网某ip)

curl请求指定host ip(指定域名解析的内网某ip)

   

域名www.test.com解析内部多台ip
$httpHeader = array(‘Host: www.test.com‘);
$url = "10.17.2.245/xxx/xxx/t.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);

curl_setopt($ch, CURLOPT_URL, $url);

SHELL:

curl --silent -H "Host: www.test.com" "192.168.0.1/xxx/xxx/t.php"

curl请求指定host ip(指定域名解析的内网某ip)