2013-05-06 93 views
1

我想测试,如果之前我处理我的代码存在远程图像..如何检查远程服务器映像是否存在?

我发现这个职位

How can one check to see if a remote file exists using PHP?

我试图getimagesize功能和file_get_contents功能,但我得到了

Warning: getimagesize() [function.getimagesize]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /project/testImages.php on line 147 

我无法在我的情况下修改服务器配置。

我不确定如何解决错误或者是否有其他解决方法。

感谢您的任何帮助。

+0

[查看此答案](http://stackoverflow.com/a/982045/1729885)。 – 2013-05-06 23:47:21

+0

为什么你需要知道这个图像是否存在?因为你的服务器可能拒绝外部访问。 – 2013-05-06 23:59:08

回答

0

为什么不尝试cURLCURLOPT_HEADER设置为1(或true)?然后检查返回的内容以获得服务器响应。我就是这么做的。

相关问题