Fixing Error Handling When Not Using cURL