The curly library essentially implements popen() by piping the output of curl to a temporary file via system(). The file is then opened and the results are passed back to the calling program. This approach has the advantage that the developer can view the response outside of the program and known responses can be injected during unit test.