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?
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 this into your code:
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)');
链接地址: http://www.djcxy.com/p/94478.html
上一篇: btDefaultMotionState的多个实例都被忽略,但是只有一个
下一篇: 无法打开流。 错误的请求