NAME |C SYNOPSIS |DESCRIPTION |DIAGNOSTICS |SEE ALSO |COLOPHON | |
PMHTTPNEWCLIENT(3) Library Functions ManualPMHTTPNEWCLIENT(3)pmhttpNewClient,pmhttpFreeClient,pmhttpClientFetch- simple HTTP client interfaces
#include <pcp/pmapi.h>#include <pcp/pmhttp.h>struct http_client *pmhttpNewClient(void);void pmhttpFreeClient(struct http_client *client);int pmhttpClientFetch(struct http_client *client, const char *url,char *bodybuf, size_tbodylen,char *typebuf, size_ttypelen);cc ... -lpcp_web
pmhttpNewClientallocates and initializes an opaque HTTP client that is ready to make requests from a server. The URL request interfacepmhttpClientFetchissues an HTTP GET re‐ quest to the server specified in the suppliedurl. The body of the response is returned in the caller suppliedbodybuf buffer, ofbodylen bytes length. An optionaltypebuf buffer, oftypelen bytes length, can also be supplied and (if non-NULL) will contain the value of the content-type header returned from the server. Theurl parameter is anRFC1630 format URL. This will typically be prefixed with "http://", however these interfaces also support Unix domain sockets. Those are instead prefixed by "unix://", followed by the full filesystem path to the desired Unix domain socket. To free up resources associated with an HTTP client, including closing any persistent server connection that has been established earlier, is accomplished using thepmhttpFreeClientroutine.
pmhttpNewClientwill return NULL on failure, which can only occur when allocation of memory is not possible.pmhttpClientFetchwill return the number of bytes places into thebodybuf buffer, else a negated error code indicating the nature of the failure.
pmdaapache(1),pmjsonInit(3),PMAPI(3),PMWEBAPI(3) andhttps://tools.ietf.org/html/rfc1630.
This page is part of thePCP (Performance Co-Pilot) project. In‐ formation about the project can be found at ⟨http://www.pcp.io/⟩. If you have a bug report for this manual page, send it to pcp@groups.io. This page was obtained from the project's upstream Git repository ⟨https://github.com/performancecopilot/pcp.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-11.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgPerformance Co-Pilot PCPPMHTTPNEWCLIENT(3)HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |