Better approach for handling HEAD requests with cURL