简体   繁体   English

PHP俄语url编码

[英]PHP Russian url encoding

When using this url-string in Simple_XML - http://квартиры-домики.рф/Admin/Import/rieltonReport.xml 在Simple_XML中使用此url字符串时http://квартиры-домики.рф/Admin/Import/rieltonReport.xml

I get this error - 我收到此错误-

simplexml_load_file(http://%D0%BA%D0%B2%D0%B0%D1%80%D1%82%D0%B8%D1%80%D1%8B0%B4%D0%BE%D0%BC%D0%B8%D0%BA%D0%B8.%D1%80%D1%84/Admin/Import/rieltonReport.xml) [function.simplexml-load-file]: failed to open stream: php_network_getaddresses:getaddrinfo failed: hostname nor servname provided, or not known

Is is possible to somehow point to the web-site using a url-encoder (tinyurl), or make php understand the russian letters? 是否可能以某种方式使用url编码器(tinyurl)指向网站,或使php理解俄语字母?

If you have installed PHP 5 >= 5.3.0, PECL intl >= 1.0.2 and PECL idn >= 0.1, you can use function 如果您已安装PHP 5> = 5.3.0,PECL intl> = 1.0.2和PECL idn> = 0.1,则可以使用function

idn_to_ascii('домики.рф');

for converting domain name. 用于转换域名。 You can read documentation about this functionality here: http://php.net/manual/ru/function.idn-to-ascii.php 您可以在此处阅读有关此功能的文档: http : //php.net/manual/ru/function.idn-to-ascii.php

If you can't install pecl library, you can use another solution on plain php: http://phlymail.com/en/downloads/idna/ 如果无法安装pecl库,则可以在纯php上使用另一种解决方案: http ://phlymail.com/en/downloads/idna/

Apparently, there is a standard for writing out domain names in different languages. 显然,存在一种以不同语言写出域名的标准。

An alias for such domain is created - http://xn----7sbfkscajgsvub0a1l.xn--p1ai/ . 将为该域创建一个别名-http://xn----7sbfkscajgsvub0a1l.xn--p1ai/

For Chrome, just have to copy from the browser. 对于Chrome,只需从浏览器复制即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM