Pure PHP version of HTTPRequest implementation via cURL library