From: Michael Wallner Date: Mon, 7 Mar 2005 13:04:33 +0000 (+0000) Subject: * docs X-Git-Tag: RELEASE_0_6_1~2 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=ba19f725bf87926599d3e7492a3fbb5ef71a9a49 * docs --- diff --git a/http_methods.c b/http_methods.c index 522c2a3..4953d27 100644 --- a/http_methods.c +++ b/http_methods.c @@ -989,7 +989,7 @@ PHP_METHOD(HTTPi_Request, unsetPostFiles) /* {{{ proto array HTTPi_Request::getResponseData() * - * Get all resposonse data after the request has been sent. + * Get all response data after the request has been sent. */ PHP_METHOD(HTTPi_Request, getResponseData) { @@ -1014,16 +1014,16 @@ PHP_METHOD(HTTPi_Request, getResponseHeader) char *header_name = NULL; int header_len = 0; getObject(httpi_response_object, obj); - + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &header_name, &header_len)) { RETURN_FALSE; } - + data = GET_PROP(obj, responseData); if (SUCCESS != zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &headers)) { RETURN_FALSE; } - + if (!header_len || !header_name) { array_init(return_value); array_copy(*headers, return_value); @@ -1062,9 +1062,9 @@ PHP_METHOD(HTTPi_Request, getResponseCode) { zval **code, **hdrs, *data; getObject(httpi_request_object, obj); - + NO_ARGS; - + data = GET_PROP(obj, responseData); if ( (SUCCESS == zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &hdrs)) && (SUCCESS == zend_hash_find(Z_ARRVAL_PP(hdrs), "Status", sizeof("Status"), (void **) &code))) { @@ -1093,7 +1093,7 @@ PHP_METHOD(HTTPi_Request, getResponseInfo) } info = GET_PROP(obj, responseInfo); - + if (info_len && info_name) { if (SUCCESS == zend_hash_find(Z_ARRVAL_P(info), pretty_key(info_name, info_len, 0, 0), info_len + 1, (void **) &infop)) { RETURN_ZVAL(*infop, 1, ZVAL_PTR_DTOR); @@ -1111,6 +1111,31 @@ PHP_METHOD(HTTPi_Request, getResponseInfo) /* {{{ proto bool HTTPi_Request::send() * * Send the HTTP request. + * + * GET example: + *
+ * setOptions(array('lastmodified' => filemtime('local.rss')));
+ * $r->addQueryData(array('category' => 3));
+ * if ($r->send() && $r->getResponseCode() == 200) {
+ *     file_put_contents('local.rss', $r->getResponseBody());
+ * }
+ * ?>
+ * 
+ * + * POST example: + *
+ * setOptions(array('cookies' => array('lang' => 'de')));
+ * $r->addPostData(array('user' => 'mike', 'pass' => 's3c|r3t'));
+ * $r->addPostFile('image', 'profile.jpg', 'image/jpeg');
+ * if ($r->send()) {
+ *     echo $r->getResponseBody();
+ * }
+ * ?>
+ * 
*/ PHP_METHOD(HTTPi_Request, send) {