Added fallback if curl is not available.

Some servers do not have curl and many people consider curl not portable as it's not part of the PHP core. This adds a fallback method if curl is not available.