create a function called make_request and re-use it for both getCode and request instead of two independent out of sync cURL functions