+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sla!", &URL, &URL_len, &meth, &options)) {
+ if (URL) {
+ UPD_STRL(url, URL, URL_len);
+ }
+ if (meth > -1) {
+ UPD_PROP(long, method, meth);
+ }
+ if (options) {
+ zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "setoptions", NULL, options);
+ }
+ }
+ SET_EH_NORMAL();
+}
+/* }}} */
+
+/* {{{ proto HttpRequest HttpRequest::factory([string url[, int request_method HTTP_METH_GET[, array options[, string class_name = "HttpRequest"]]]])
+ Create a new HttpRequest object instance. */
+PHP_METHOD(HttpRequest, factory)
+{
+ char *cn = NULL, *URL = NULL;
+ int cl = 0, URL_len = 0;
+ long meth = -1;
+ zval *options = NULL;
+ zend_object_value ov;
+
+ SET_EH_THROW_HTTP();
+ if ( SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sla!s", &URL, &URL_len, &meth, &options, &cn, &cl) &&
+ SUCCESS == http_object_new(&ov, cn, cl, _http_request_object_new_ex, http_request_object_ce, NULL, NULL)) {
+ RETVAL_OBJVAL(ov, 0);
+ getThis() = return_value;