- if (!strcasecmp("POST", message->http.info.request.method)) {
- http_request_body body = {HTTP_REQUEST_BODY_CSTRING, PHPSTR_VAL(message), PHPSTR_LEN(message)};
- rs = http_post(uri, &body, Z_ARRVAL(options), NULL, NULL);
- } else
- if (!strcasecmp("GET", message->http.info.request.method)) {
- rs = http_get(uri, Z_ARRVAL(options), NULL, NULL);
- } else
- if (!strcasecmp("HEAD", message->http.info.request.method)) {
- rs = http_head(uri, Z_ARRVAL(options), NULL, NULL);
+ if ((request.meth = http_request_method_exists(1, 0, message->http.info.request.method))) {
+ http_request_body body;
+
+ http_request_init_ex(&request, NULL, request.meth, uri);
+ request.body = http_request_body_init_ex(&body, HTTP_REQUEST_BODY_CSTRING, PHPSTR_VAL(message), PHPSTR_LEN(message), 0);
+ if (SUCCESS == (rs = http_request_prepare(&request, NULL))) {
+ http_request_exec(&request);
+ }
+ http_request_dtor(&request);