php curl 域名解析到指定IP

只适用于http请求

linux下curl -H “Host: xxx.cuchunhua.com” “http://ip/xx/x/x”

<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://10.3.25.89/counter/userLogApi/add');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Host:xx.xuchunhua.com']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, []);
curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($status);
Posted in : php


4 thoughts on “php curl 域名解析到指定IP

  1. 笑八达说道:

    世间博客不少,风景这边独好!

    1. xuchunhua说道:

      眼光不错

  2. 三五游戏说道:

    这里来不够,看不够,玩不够!

  3. 快乐赚说道:

    这个博客不简单,看了还想接着看。

笑八达进行回复 取消回复

电子邮件地址不会被公开。 必填项已用*标注