本文介绍了file_get_contents()函数:php_network_getaddresses:失败的getaddrinfo:产品名称或服务不知道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着去使用我的XAMPP服务器上的网站的PHP脚本的服务器上下载的图像。图像被使用函数的file_get_contents方法dowloaded。
PHP的code从服务器下载的是:

Im trying to download an image from a server using php script on my website on xampp server. the image is being dowloaded using the function file_get_contents method.the php code for downloading from server is:

if(isset($_GET['path']) && isset($_GET['username'])) {
  echo "path:".$_GET['path'];
  $temp = explode(".", $_GET['path']);
  $extension = end($temp);
  $fname="images/".$_GET['title'];
  $filenameIn  = $_GET['path'];
  $filenameOut = "" . $fname;
  $contentOrFalseOnFailure   = file_get_contents($filenameIn);
  $byteCountOrFalseOnFailure = file_put_contents($filenameOut,$contentOrFalseOnFailure);
}

但我为得到这个错误:警告:
    file_get_contents()函数:php_network_getaddresses:失败的getaddrinfo:姓名或/opt/lampp/htdocs/xampp/project/upload_art.php不知道第19行服务

But i m getting this error: Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/xampp/project/upload_art.php on line 19

警告:的file_get_contents(http://app6.pixlr.com/_temp/528afa6e2f7cc6a5b1000101.jpg):未能打开流:php_network_getaddresses:失败的getaddrinfo:姓名或/opt/lampp/htdocs/xampp/project/upload_art.php不知道第19行服务

Warning: file_get_contents(http://app6.pixlr.com/_temp/528afa6e2f7cc6a5b1000101.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/xampp/project/upload_art.php on line 19

我已经在这里检查了所有张贴的答案,但没有一个似乎解决该问题。请大家帮忙!

I have checked out all posted answers here but none seems to resolve the issue. please help!

推荐答案

这意味着你的服务器无法连接到外面的世界。

It means your server cannot connect to the outside world

这或许给了DNS的问题将不会改变任何东西。

This probably won't change anything given the DNS issues

所以,如果您有权限,尝试在/etc/resolv.conf文件,以其他名称服务器更改名称服务器。

So, If you have permission, try changing the name servers in your /etc/resolv.conf file to other nameservers.

这篇关于file_get_contents()函数:php_network_getaddresses:失败的getaddrinfo:产品名称或服务不知道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-04 17:07
查看更多