I created a script to load an image from an URL using CURL. To test that the file is a JPG, I’m using ($info[‘content_type’] == ‘image/jpeg’).
It works on most of the urls, but some return a html type : e.g http://www.super-fond.fr/IMAGES_VOITURES/lexus/2005-Lexus-LF-A-Concept-R-1280×960.jpg
Could anyone tell me why this URL is html ?
Thanks
It is because you not set a user-agent in request headers and this host rejects request with specific user-agent.
See
CURLOPT_USERAGENTincurl_setopt()on how to set the user-agent: