Refactor cURL request