
get_headers 함수는 URL 주소만 사용해도 됩니다. URL 인코딩은 필요하지 않습니다.
get_headers 함수를 사용하여 가져올 수 있는 HTTP 헤더 정보는 다음과 같습니다.
- HTTP 버전
- HTTP 상태 코드
- HTTP 상태 메시지
- Content-Type
- Content-Length
- Server
- Date
- Connection
- Cache-Control
- Accept-Ranges
예를 들어, 다음 코드는 URL 주소 'https://www.example.com'의 HTTP 헤더 정보를 가져옵니다.
#hostingforum.kr
php
$headers = get_headers('https://www.example.com');
print_r($headers);
이 코드는 'https://www.example.com'의 HTTP 헤더 정보를 가져와서 배열로 출력합니다.
2025-04-14 12:39