I have a URL that can be accessible via HTTP or HTTPS. I want to send a HEAD or GET request, which ever is fastest and get the response code so I know whether the URL is up or down.
How do I do that using Zend_HTTP_Client? I used get_headers() function, but it’s very very slow on some remote servers. I am not sure if it handles HTTPS.
You may not want to use
Zend_Http_Clientfor this – use native PHP functions instead (likefsockopensince it seems you want this to be efficient).That said, this may work for you (and since it defaults to the socket adapter, it may not be that less efficient than using the native functions):
If not, you could try setting the cURL options manually.
The code’s not tested. Use at your own risk.