updated most of the code to use curl no ext dependency