I'm writing a script that will use cURL to check a number of links. I know I can use curl_getinfo() to get the http status code, but I'm not sure if that requests the entire page or just the response with the headers. Is there any curl option or setting I can use to only request the headers of the URL (i.e. 404 not found, moved, etc) ?
Asked
Active
Viewed 86 times
0
Steve
- 2,936
- 5
- 27
- 38
1 Answers
1
You can instruct cURL to not download the contents (body) of the request by setting the CURLOPT_NOBODY option to TRUE - see
Does CURLOPT_NOBODY still download the body - using bandwidth
p.s. curl_getinfo() does not make requests - it gets information from requests that have already been executed.
Community
- 1
- 1
Emanuil Rusev
- 34,563
- 55
- 137
- 201