Skip to content
Advertisement

Tag: getimagesize

PHP getimagesize – Failed to open stream. Bad request

I am getting the following error: getimagesize(https://static1.squarespace.com/static/570d03d02b8dde8b2642afca/570f74e87c65e4819dec6812/57272dbfb6aa606f78a5d8b5/1470397291105/4XTRYCK3.jpg): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request The image opens without problems in my browser. Does anyone understand why this fails? Answer Squarespace is rejecting any connection where the User-Agent header is not a web browser. This includes CURL and getimagesize. You can set the user-agent header by inserting

Advertisement