Reputation: 73
I'm trying to get information about the image (from URL: https://ec.europa.eu/maritimeaffairs/maritimeday/sites/mare-emd/files/exhibitions-2016.png) by getimagesize()
function.
When I run my function I get an error as the title of this question.
But I can still open this image from browser.
Could someone tell me why? Is there difference between between opening the image with PHP and the browser?
Thanks.
Upvotes: 1
Views: 1908
Reputation: 2582
Yes there is a difference between PHP and the browser. The PHP is running most of the time on the server and can get data from the web. The browser runs on your computer (as a client) and can also get data from the web. The browser has already implemented a lot of things you don't need to worry about when it comes to networks communication.
PHP is a language that offers you some libraries for communicating in the web and getting data, but you have to implement that yourself and think about what is happening their in detail.
You are probably calling getimagesize('https://ec.europa.eu/maritimeaffairs/maritimeday/sites/mare-emd/files/exhibitions-2016.png');
You browser handles encryption for you, but PHP has sometimes encryption support not enabled. Try a URL starting with http: instead of https:, if that works, this is the problem.
Upvotes: 1