PHP函数getimagesize()给出“读取错误”。当试图获取https网址时 [英] PHP function getimagesize() gives "Read error" when trying to get https url

查看:4171
本文介绍了PHP函数getimagesize()给出“读取错误”。当试图获取https网址时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有URL的getimagesize和http一切都很好。但是,当尝试在https url上使用函数时,我收到读取错误通知,结果为false。我查了一下,我在服务器上安装了OpenSSL 0.98(因此它也应该与https一起使用)。
我知道我可以先下载图片然后再使用它,但在我看来这样应该可行并且我遗漏了一些东西。你能否提供一些解决方案(除了首先下载图像然后打开它)?

I am trying to use getimagesize with URL and with http everything is fine. However when trying to use function on https url I am getting "Read error" Notice and false as result. I checked and I have OpenSSL 0.98 installed on the server (so it should be working with https as well). I know that I can download the image first and then use it but it seems to me like this should work and that I am missing something. Could you please provide me with some solution (other than downloading the image first and then opening it) ?

提前谢谢你。

推荐答案

您可以使用 file_get_contents()作为替代解决方案..

You can use file_get_contents() as an alternate solution..

<?php
$filename='something';
file_put_contents($filename,file_get_contents($url));
$size = getimagesize($filename);
var_dump($size);

这篇关于PHP函数getimagesize()给出“读取错误”。当试图获取https网址时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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