Use cURL extension if available

The HTTP client requires fopen wrappers (allow_url_fopen in global php.ini) which are disabled on many sites for security reasons. This patch uses cURL for sending HTTP requests if avaliable and falls back to fopen wrappers if not. If neither are available, the thrown exception gets a meaningful message.