Removal of curl dependency in PHP