简体   繁体   中英

PHP file_get_contents unable to get content

I am using file_get_contents to get api result from a URL in json format. However, there is an issue in file_get_contents when i call the url. The error returns is

file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known

The url im using is calling a load balancer server before forward to the main api server. If i were to directly change the url to main api server ip address, i am able to get the results. However, if i call through load balancer url it returns error message

Is it something i need to configure in loadbalancer server?

  • update: seems to be a domain name issue? i tried calling using load balancer direct IP address. it is working. But when i switch back to a domain name url, it is failing.

I'm actually calling a internal server api domain. So, i had to configure the server host file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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