file_get_contents(): php_network_getaddresses: getaddrinfo 失败: 名称或服务未知 [英] file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known

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

问题描述

我正在尝试使用 xampp 服务器上我网站上的 PHP 脚本从服务器下载图像.

I'm trying to download an image from a server using a PHP script on my website on xampp server.

正在使用函数 file_get_contents 下载图像.

The image is being downloaded using the function file_get_contents.

服务器上下载的php代码为:

The php code for downloading on the 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 failed: Name or service not known in/opt/lampp/htdocs/xampp/project/upload_art.php 第 19 行

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/528afa6e2f7cc6a5b10jpg0/a>):无法打开流: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 失败: 名称或服务未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆