如何使用curl从umlaut域获取数据?

如何使用curl从umlaut域获取数据?,curl,host,Curl,Host,我尝试通过curl从umlaut域获取数据。好吧,它不工作,我得到错误: Could not resolve host: http://müller.de/ Host not found Curl中的以下设置 $agent= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'; $ch = curl_init(); curl_set

我尝试通过curl从umlaut域获取数据。好吧,它不工作,我得到错误:

Could not resolve host: http://müller.de/ Host not found
Curl中的以下设置

    $agent= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_URL, 'http://müller.de/');             
    $result = curl_exec ($ch);

在尝试了很多东西之后,答案真的很简单。我必须直接使用punycoded URL,只需在此处使用转换器:

我在stackoverflow上没有发现任何东西,所以我分享了我的第一个问答风格,hops this helps someone:)