Tags
PHP
Asked 8 years ago
6 Oct 2016
Views 916
Phpworker

Phpworker posted

file_get_contents() give me error php_network_getaddresses: getaddrinfo failed

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known.

file_get_contents("https://www.amazon.in/rss/bestsellers/books?tag=my-assoc-tag");

how to resolve it ?
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

mostly two reason to get this error
1. bad hostname , dead url
2. bad intenet connection .
pls check you url and internet is working or not ?
ravi

ravi
answered Nov 30 '-1 00:00

Error "php_network_getaddresses: getaddrinfo failed: No such host is known" arise when coder did not provide valid url . its means dead url give this error but in your case your url is working perfect .
but still try to refresh one more time sometime it give error without reason because some network error possible
Post Answer