Home > Article > Backend Development > PHP uses request header information to obtain the remote image size
The same as initiating a GET request, just set the request type GET to HEAD. Just modify the requested host and path to what you need. Summary: PHP can also use get_headers to obtain header information. After testing this function, it is a GET request. For details, please refer to: php function get_headers is a HEAD request or GET request . In addition, some servers may block HEAD requests. If blocked, you can only use GET requests. In this way, you can directly use the ready-made function getimagesize to get the size of the image. |