Phone: 15534080002 Email: mail.min@163.com

php curl多次請(qǐng)求返回慢與curl自身域名DNS轉(zhuǎn)換有關(guān),修改成IP請(qǐng)求后正常

2021-12-06 09:46:59 9082 山西更新科技

請(qǐng)求域名對(duì)應(yīng)host添加到請(qǐng)求頭中

<?php

$host = gethostbyname('kingcard.dgunicom.com');

curl_setopt($ch, CRULOPT_HTTPHEADER, ['Host: '.$host]);

?>

$ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, 'https://kingcard.dgunicom.com/dgZop/api/numSelect');
curl_setopt($ch, CURLOPT_URL, 'https://211.95.193.53/dgZop/api/numSelect');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);

$headers = array();
$headers[] = 'Host: kingcard.dgunicom.com';
$headers[] = 'Content-Type: application/json';
$headers[] = 'Expect:';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
echo $result;

ligengxin.com@2022 Powered by SIYUCMS
備案號(hào):晉ICP備2021016272號(hào)
欧美精品久久天天躁一,青久久久久国产线免观,欧美日韩在线视频一区二区三区,欧美日韩国产小视频
一本一本久久A精品综合 | 亚洲综合另类专区在线 | 亚洲国产精品国产自在在线 | 色鬼色无需播放器在线视频 | 午夜国产乱码福利电影 | 亚洲美女网站一区 |