1

My code:

php -r 'var_dump(file_get_contents("http://ssmss.ir"));'

which works good

my server has ping and internet and connection in centos 7 command line

this is an example of url call with linux curl command line :

 Connected to ​172.x.x.x(172.x.x.x) port 8085 (#0)
 GET /sms/getid?mid=1 HTTP/1.1
 User-Agent: curl/7.29.0
 Host: 172.x.x.x:8085
 Accept: */*

 HTTP/1.1 200 OK
 Server: Oracle XML DB/Oracle Database
 Content-Type: text/xml; charset=UTF-8
 Content-Length: 70

 <?xml version="1.0"?>

but when i use php to connect to this url it says :

file_get_contents(http://​172.x.x.x:8085/sms/getid?mid=1): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 1

i try curl with all options and it also doesn't work

what can i do?

it is very important

this is some other commands i used before sending this question:

[root@localhost ~]# setsebool -P nis_enabled 1
setsebool:  SELinux is disabled.
[root@localhost ~]# setsebool -P httpd_can_network_connect 1
setsebool:  SELinux is disabled.
[root@localhost ~]# setsebool -P httpd_verify_dns=1
setsebool:  SELinux is disabled.
[root@localhost ~]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@localhost ~]# service php-fpm restart
Redirecting to /bin/systemctl restart php-fpm.service
[root@localhost ~]# cat  /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 4.2.2.4
rodgdor
  • 2,530
  • 1
  • 19
  • 26
Mohsen Davari
  • 11
  • 1
  • 7
  • [https://stackoverflow.com/questions/20064372/file-get-contents-php-network-getaddresses-getaddrinfo-failed-name-or-servi](https://stackoverflow.com/questions/20064372/file-get-contents-php-network-getaddresses-getaddrinfo-failed-name-or-servi) – YouneL Nov 15 '17 at 15:51
  • i read this topic before but not work for me. – Mohsen Davari Nov 15 '17 at 15:55

0 Answers0