I came into problem while trying to access and images from CDN. I get Image from API successfully, and I want to get that image's MIME. For that purpose I am using PHP function getimagesize(). Example:
$imageUrl = 'https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1543344906'; // certain image is from API docs, but it's all the same with my stores images.
And I get this error after execution:
failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden.
Why am I getting 403 code and how I could avoid it?
It works, when making request with a CURL as any browser. The problem is that in the past, all these request worked without need to make the request as user agent.