PHP get http header response code without cURL

后端 未结 2 1760
误落风尘
误落风尘 2021-02-09 16:20

I have written a class that detects if cURL is available, if it is performs GET, POST, DELETE using cURL. In the cURL version I use curl_getinfo($curl, CURLINFO_HTTP_CO

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 16:51

    Use get_headers:

    
    

    Edit: get_headers requires an additional call, and is not appropriate for this scenario. Use $http_response_headers as suggested by hakre.

提交回复
热议问题