move curl request into main script