【发布时间】:2019-10-24 12:57:09
【问题描述】:
我想获取具有 unicode 名称 (http://خبر.com) 的网站内容。我尝试了以下代码。
$site = "https://خبر.com/";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $site,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_TIMEOUT => 30000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded',),
));
$response = curl_exec($curl);
curl_close($curl);
还有这个sn-p
$response = file_get_contents($site);
我也尝试获取网站的 IP,但我做不到。 我尝试了其他 Unicode 域名,但问题仍然存在。 并且英文域名正常加载。
【问题讨论】: