//要配置的虚拟域名
$host = array( 'Host: demo-local.com' );
$ch = curl_init();
//要配置的ip 例如本机localhost
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:80/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch,CURLOPT_HTTPHEADER, $host );
$ret = curl_exec($ch);
$errno=curl_errno($ch);
if( $errno ){
echo $errno.'#'.curl_error($ch);
}else{
echo 'curl return:<br/>';
echo '----------<br/>';
var_dump($ret);
echo '----------<br/>';
}
curl_close($ch);