Check curl response status before assigning to variables