html php_network_getaddresses:getaddrinfo failed:没有这样的主机已知 - localhost错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html php_network_getaddresses:getaddrinfo failed:没有这样的主机已知 - localhost错误相关的知识,希望对你有一定的参考价值。

/* If I use following to parse xml from external site on local:
-----------------
$xml = simplexml_load_file("http://www.feedsite.com");
-----------------
there is following warning:
Warning: simplexml_load_file() [function.simplexml-load-file]: php_network_getaddresses: getaddrinfo failed: No such host is known.
*/
Solution:
	Step-1)	Use Curl to fetch all xml into your local page:
			Problem: XML Parsing Error: no element found. Means you are restricted to access it directly on local.
			Solution: You might need to use proxy [ might be "wp-config" or directly "in curl" because in independent curl page does not include wp config)
			For Curl:
				curl_setopt($ch, CURLOPT_PROXY, "http-proxy.com"); //your proxy url
				curl_setopt($ch, CURLOPT_PROXYPORT, "80"); // your proxy port number 
			For wp-config:
				define('WP_PROXY_HOST', 'http-proxy.com');
				define('WP_PROXY_PORT', '80');
	Step-2) Then include that page into simplexml function:
			$xml = simplexml_load_file("http://www.feedsite.com");

以上是关于html php_network_getaddresses:getaddrinfo failed:没有这样的主机已知 - localhost错误的主要内容,如果未能解决你的问题,请参考以下文章

Laravel Mail Smtp php_network_getaddresses: getaddrinfo failed: Name or service not known

一天学会HTML 基础

Html.Partial 与 Html.RenderPartial 和 Html.Action 与 Html.RenderAction

html Html模板/ Html Boilerplate |标签HTML

html里怎么引用一个html的头部

html5与传统html区别