2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.0 of the PHP license, that |
6 | is bundled with this package in the file LICENSE, and is available |
7 | through the world-wide-web at http://www.php.net/license/3_0.txt. |
8 | If you did not receive a copy of the PHP license and are unable to |
9 | obtain it through the world-wide-web, please send a note to |
10 | license@php.net so we can mail you a copy immediately. |
11 +----------------------------------------------------------------------+
12 | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
13 +----------------------------------------------------------------------+
23 # include <winsock2.h>
26 #include <curl/curl.h>
28 #include "phpstr/phpstr.h"
32 #include "php_http_std_defs.h"
33 #include "php_http_api.h"
34 #include "php_http_curl_api.h"
35 #include "php_http_url_api.h"
37 ZEND_EXTERN_MODULE_GLOBALS(http
)
39 #if LIBCURL_VERSION_NUM >= 0x070c01
40 # define http_curl_reset(ch) curl_easy_reset(ch)
42 # define http_curl_reset(ch)
45 #if LIBCURL_VERSION_NUM < 0x070c00
46 # define http_curl_error(dummy) HTTP_G(curlerr)
47 # define curl_easy_strerror(code) "unkown error"
49 # define http_curl_error(code) curl_easy_strerror(code)
52 #define http_curl_startup(ch, clean_curl, URL, options, response) \
54 if (!(ch = curl_easy_init())) { \
55 http_error(E_WARNING, HTTP_E_CURL, "Could not initialize curl"); \
60 http_curl_reset(ch); \
62 http_curl_setopts(ch, URL, options, response);
64 #define http_curl_perform(ch, clean_curl, response) \
67 if (CURLE_OK != (result = curl_easy_perform(ch))) { \
68 http_error_ex(E_WARNING, HTTP_E_CURL, "Could not perform request: %s", curl_easy_strerror(result)); \
69 http_curl_cleanup(ch, clean_curl, response); \
74 #define http_curl_cleanup(ch, clean_curl, response) \
75 zend_llist_clean(&HTTP_G(to_free)); \
77 curl_easy_cleanup(ch); \
80 phpstr_fix(PHPSTR(response))
82 #define http_curl_copystr(s) _http_curl_copystr((s) TSRMLS_CC)
83 static inline char *_http_curl_copystr(const char *str TSRMLS_DC
);
85 #define http_curl_setopts(c, u, o, r) _http_curl_setopts((c), (u), (o), (r) TSRMLS_CC)
86 static void _http_curl_setopts(CURL
*ch
, const char *url
, HashTable
*options
, phpstr
*response TSRMLS_DC
);
88 #define http_curl_getopt(o, k, t) _http_curl_getopt_ex((o), (k), sizeof(k), (t) TSRMLS_CC)
89 #define http_curl_getopt_ex(o, k, l, t) _http_curl_getopt_ex((o), (k), (l), (t) TSRMLS_CC)
90 static inline zval
*_http_curl_getopt_ex(HashTable
*options
, char *key
, size_t keylen
, int type TSRMLS_DC
);
92 static size_t http_curl_write_callback(char *, size_t, size_t, void *);
93 static int http_curl_progress_callback(void *, double, double, double, double);
94 static int http_curl_debug_callback(CURL
*, curl_infotype
, char *, size_t, void *);
96 #define http_curl_getinfo(c, h) _http_curl_getinfo((c), (h) TSRMLS_CC)
97 static inline void _http_curl_getinfo(CURL
*ch
, HashTable
*info TSRMLS_DC
);
99 /* {{{ static inline char *http_curl_copystr(char *) */
100 static inline char *_http_curl_copystr(const char *str TSRMLS_DC
)
102 char *new_str
= estrdup(str
);
103 zend_llist_add_element(&HTTP_G(to_free
), &new_str
);
108 /* {{{ static size_t http_curl_write_callback(char *, size_t, size_t, void *) */
109 static size_t http_curl_write_callback(char *buf
, size_t len
, size_t n
, void *s
)
111 return s
? phpstr_append(PHPSTR(s
), buf
, len
* n
) : len
* n
;
115 /* {{{ static int http_curl_progress_callback(void *, double, double, double, double) */
116 static int http_curl_progress_callback(void *data
, double dltotal
, double dlnow
, double ultotal
, double ulnow
)
118 zval
*params_pass
[4], params_local
[4], retval
, *func
= (zval
*) data
;
121 params_pass
[0] = ¶ms_local
[0];
122 params_pass
[1] = ¶ms_local
[1];
123 params_pass
[2] = ¶ms_local
[2];
124 params_pass
[3] = ¶ms_local
[3];
126 ZVAL_DOUBLE(params_pass
[0], dltotal
);
127 ZVAL_DOUBLE(params_pass
[1], dlnow
);
128 ZVAL_DOUBLE(params_pass
[2], ultotal
);
129 ZVAL_DOUBLE(params_pass
[3], ulnow
);
131 return call_user_function(EG(function_table
), NULL
, func
, &retval
, 4, params_pass TSRMLS_CC
);
135 static int http_curl_debug_callback(CURL
*ch
, curl_infotype type
, char *string
, size_t length
, void *data
)
137 zval
*params_pass
[2], params_local
[2], retval
, *func
= (zval
*) data
;
140 params_pass
[0] = ¶ms_local
[0];
141 params_pass
[1] = ¶ms_local
[1];
143 ZVAL_LONG(params_pass
[0], type
);
144 ZVAL_STRINGL(params_pass
[1], string
, length
, 1);
146 call_user_function(EG(function_table
), NULL
, func
, &retval
, 2, params_pass TSRMLS_CC
);
150 /* {{{ static inline zval *http_curl_getopt(HashTable *, char *, size_t, int) */
151 static inline zval
*_http_curl_getopt_ex(HashTable
*options
, char *key
, size_t keylen
, int type TSRMLS_DC
)
155 if (!options
|| (SUCCESS
!= zend_hash_find(options
, key
, keylen
, (void **) &zoption
))) {
159 if (Z_TYPE_PP(zoption
) != type
) {
162 case IS_BOOL
: convert_to_boolean_ex(zoption
); break;
163 case IS_LONG
: convert_to_long_ex(zoption
); break;
164 case IS_DOUBLE
: convert_to_double_ex(zoption
); break;
165 case IS_STRING
: convert_to_string_ex(zoption
); break;
166 case IS_ARRAY
: convert_to_array_ex(zoption
); break;
167 case IS_OBJECT
: convert_to_object_ex(zoption
); break;
177 /* {{{ static void http_curl_setopts(CURL *, char *, HashTable *, phpstr *) */
178 static void _http_curl_setopts(CURL
*ch
, const char *url
, HashTable
*options
, phpstr
*response TSRMLS_DC
)
181 zend_bool range_req
= 0;
183 #define HTTP_CURL_OPT(OPTION, p) curl_easy_setopt(ch, CURLOPT_##OPTION, (p))
185 /* standard options */
187 HTTP_CURL_OPT(URL
, url
);
190 HTTP_CURL_OPT(HEADER
, 0);
191 HTTP_CURL_OPT(FILETIME
, 1);
192 HTTP_CURL_OPT(NOPROGRESS
, 1);
193 HTTP_CURL_OPT(AUTOREFERER
, 1);
194 HTTP_CURL_OPT(WRITEFUNCTION
, http_curl_write_callback
);
195 HTTP_CURL_OPT(HEADERFUNCTION
, http_curl_write_callback
);
198 HTTP_CURL_OPT(WRITEDATA
, response
);
199 HTTP_CURL_OPT(WRITEHEADER
, response
);
202 #if defined(ZTS) && (LIBCURL_VERSION_NUM >= 0x070a00)
203 HTTP_CURL_OPT(NOSIGNAL
, 1);
205 #if LIBCURL_VERSION_NUM < 0x070c00
206 HTTP_CURL_OPT(ERRORBUFFER
, HTTP_G(curlerr
));
209 /* progress callback */
210 if (zoption
= http_curl_getopt(options
, "onprogress", 0)) {
211 HTTP_CURL_OPT(NOPROGRESS
, 0);
212 HTTP_CURL_OPT(PROGRESSFUNCTION
, http_curl_progress_callback
);
213 HTTP_CURL_OPT(PROGRESSDATA
, zoption
);
215 HTTP_CURL_OPT(NOPROGRESS
, 1);
219 if (zoption
= http_curl_getopt(options
, "ondebug", 0)) {
220 HTTP_CURL_OPT(VERBOSE
, 1);
221 HTTP_CURL_OPT(DEBUGFUNCTION
, http_curl_debug_callback
);
222 HTTP_CURL_OPT(DEBUGDATA
, zoption
);
224 HTTP_CURL_OPT(VERBOSE
, 0);
228 if (zoption
= http_curl_getopt(options
, "proxyhost", IS_STRING
)) {
229 HTTP_CURL_OPT(PROXY
, http_curl_copystr(Z_STRVAL_P(zoption
)));
231 if (zoption
= http_curl_getopt(options
, "proxyport", IS_LONG
)) {
232 HTTP_CURL_OPT(PROXYPORT
, Z_LVAL_P(zoption
));
235 if (zoption
= http_curl_getopt(options
, "proxyauth", IS_STRING
)) {
236 HTTP_CURL_OPT(PROXYUSERPWD
, http_curl_copystr(Z_STRVAL_P(zoption
)));
238 #if LIBCURL_VERSION_NUM >= 0x070a07
240 if (zoption
= http_curl_getopt(options
, "proxyauthtype", IS_LONG
)) {
241 HTTP_CURL_OPT(PROXYAUTH
, Z_LVAL_P(zoption
));
246 /* outgoing interface */
247 if (zoption
= http_curl_getopt(options
, "interface", IS_STRING
)) {
248 HTTP_CURL_OPT(INTERFACE
, http_curl_copystr(Z_STRVAL_P(zoption
)));
252 if (zoption
= http_curl_getopt(options
, "port", IS_LONG
)) {
253 HTTP_CURL_OPT(PORT
, Z_LVAL_P(zoption
));
257 if (zoption
= http_curl_getopt(options
, "httpauth", IS_STRING
)) {
258 HTTP_CURL_OPT(USERPWD
, http_curl_copystr(Z_STRVAL_P(zoption
)));
260 #if LIBCURL_VERSION_NUM >= 0x070a06
261 if (zoption
= http_curl_getopt(options
, "httpauthtype", IS_LONG
)) {
262 HTTP_CURL_OPT(HTTPAUTH
, Z_LVAL_P(zoption
));
266 /* compress, empty string enables deflate and gzip */
267 if (zoption
= http_curl_getopt(options
, "compress", IS_BOOL
)) {
268 if (Z_LVAL_P(zoption
)) {
269 HTTP_CURL_OPT(ENCODING
, http_curl_copystr(""));
273 /* redirects, defaults to 0 */
274 if (zoption
= http_curl_getopt(options
, "redirect", IS_LONG
)) {
275 HTTP_CURL_OPT(FOLLOWLOCATION
, Z_LVAL_P(zoption
) ? 1 : 0);
276 HTTP_CURL_OPT(MAXREDIRS
, Z_LVAL_P(zoption
));
277 if (zoption
= http_curl_getopt(options
, "unrestrictedauth", IS_BOOL
)) {
278 HTTP_CURL_OPT(UNRESTRICTED_AUTH
, Z_LVAL_P(zoption
));
281 HTTP_CURL_OPT(FOLLOWLOCATION
, 0);
285 if (zoption
= http_curl_getopt(options
, "referer", IS_STRING
)) {
286 HTTP_CURL_OPT(REFERER
, http_curl_copystr(Z_STRVAL_P(zoption
)));
289 /* useragent, default "PECL::HTTP/version (PHP/version)" */
290 if (zoption
= http_curl_getopt(options
, "useragent", IS_STRING
)) {
291 HTTP_CURL_OPT(USERAGENT
, http_curl_copystr(Z_STRVAL_P(zoption
)));
293 HTTP_CURL_OPT(USERAGENT
,
294 "PECL::HTTP/" HTTP_PEXT_VERSION
" (PHP/" PHP_VERSION
")");
297 /* additional headers, array('name' => 'value') */
298 if (zoption
= http_curl_getopt(options
, "headers", IS_ARRAY
)) {
301 struct curl_slist
*headers
= NULL
;
303 FOREACH_KEY(zoption
, header_key
, header_idx
) {
306 if (SUCCESS
== zend_hash_get_current_data(Z_ARRVAL_P(zoption
), (void **) &header_val
)) {
307 char header
[1024] = {0};
308 snprintf(header
, 1023, "%s: %s", header_key
, Z_STRVAL_PP(header_val
));
309 headers
= curl_slist_append(headers
, http_curl_copystr(header
));
318 HTTP_CURL_OPT(HTTPHEADER
, headers
);
322 /* cookies, array('name' => 'value') */
323 if (zoption
= http_curl_getopt(options
, "cookies", IS_ARRAY
)) {
324 char *cookie_key
= NULL
;
326 phpstr
*qstr
= phpstr_new();
328 FOREACH_KEY(zoption
, cookie_key
, cookie_idx
) {
331 if (SUCCESS
== zend_hash_get_current_data(Z_ARRVAL_P(zoption
), (void **) &cookie_val
)) {
332 phpstr_appendf(qstr
, "%s=%s; ", cookie_key
, Z_STRVAL_PP(cookie_val
));
342 HTTP_CURL_OPT(COOKIE
, http_curl_copystr(qstr
->data
));
348 if (zoption
= http_curl_getopt(options
, "cookiestore", IS_STRING
)) {
349 HTTP_CURL_OPT(COOKIEFILE
, http_curl_copystr(Z_STRVAL_P(zoption
)));
350 HTTP_CURL_OPT(COOKIEJAR
, http_curl_copystr(Z_STRVAL_P(zoption
)));
354 if (zoption
= http_curl_getopt(options
, "resume", IS_LONG
)) {
356 HTTP_CURL_OPT(RESUME_FROM
, Z_LVAL_P(zoption
));
360 if (zoption
= http_curl_getopt(options
, "maxfilesize", IS_LONG
)) {
361 HTTP_CURL_OPT(MAXFILESIZE
, Z_LVAL_P(zoption
));
365 if (zoption
= http_curl_getopt(options
, "lastmodified", IS_LONG
)) {
366 HTTP_CURL_OPT(TIMECONDITION
, range_req
? CURL_TIMECOND_IFUNMODSINCE
: CURL_TIMECOND_IFMODSINCE
);
367 HTTP_CURL_OPT(TIMEVALUE
, Z_LVAL_P(zoption
));
371 if (zoption
= http_curl_getopt(options
, "timeout", IS_LONG
)) {
372 HTTP_CURL_OPT(TIMEOUT
, Z_LVAL_P(zoption
));
375 /* connecttimeout, defaults to 1 */
376 if (zoption
= http_curl_getopt(options
, "connecttimeout", IS_LONG
)) {
377 HTTP_CURL_OPT(CONNECTTIMEOUT
, Z_LVAL_P(zoption
));
379 HTTP_CURL_OPT(CONNECTTIMEOUT
, 1);
383 if (zoption
= http_curl_getopt(options
, "ssl", IS_ARRAY
)) {
384 #define HTTP_CURL_OPT_STRING(keyname) HTTP_CURL_OPT_STRING_EX(keyname, keyname)
385 #define HTTP_CURL_OPT_SSL_STRING(keyname) HTTP_CURL_OPT_STRING_EX(keyname, SSL##keyname)
386 #define HTTP_CURL_OPT_SSL_STRING_(keyname) HTTP_CURL_OPT_STRING_EX(keyname, SSL_##keyname)
387 #define HTTP_CURL_OPT_STRING_EX(keyname, optname) \
388 if (!strcasecmp(key, #keyname)) { \
389 convert_to_string_ex(param); \
390 HTTP_CURL_OPT(optname, http_curl_copystr(Z_STRVAL_PP(param))); \
394 #define HTTP_CURL_OPT_LONG(keyname) HTTP_OPT_SSL_LONG_EX(keyname, keyname)
395 #define HTTP_CURL_OPT_SSL_LONG(keyname) HTTP_CURL_OPT_LONG_EX(keyname, SSL##keyname)
396 #define HTTP_CURL_OPT_SSL_LONG_(keyname) HTTP_CURL_OPT_LONG_EX(keyname, SSL_##keyname)
397 #define HTTP_CURL_OPT_LONG_EX(keyname, optname) \
398 if (!strcasecmp(key, #keyname)) { \
399 convert_to_long_ex(param); \
400 HTTP_CURL_OPT(optname, Z_LVAL_PP(param)); \
409 FOREACH_KEYVAL(zoption
, key
, idx
, param
) {
410 if (key
) {fprintf(stderr
, "%s\n", key
);
411 HTTP_CURL_OPT_SSL_STRING(CERT
);
412 #if LIBCURL_VERSION_NUM >= 0x070903
413 HTTP_CURL_OPT_SSL_STRING(CERTTYPE
);
415 HTTP_CURL_OPT_SSL_STRING(CERTPASSWD
);
417 HTTP_CURL_OPT_SSL_STRING(KEY
);
418 HTTP_CURL_OPT_SSL_STRING(KEYTYPE
);
419 HTTP_CURL_OPT_SSL_STRING(KEYPASSWD
);
421 HTTP_CURL_OPT_SSL_STRING(ENGINE
);
422 HTTP_CURL_OPT_SSL_LONG(VERSION
);
424 HTTP_CURL_OPT_SSL_LONG_(VERIFYPEER
);
425 HTTP_CURL_OPT_SSL_LONG_(VERIFYHOST
);
426 HTTP_CURL_OPT_SSL_STRING_(CIPHER_LIST
);
429 HTTP_CURL_OPT_STRING(CAINFO
);
430 #if LIBCURL_VERSION_NUM >= 0x070908
431 HTTP_CURL_OPT_STRING(CAPATH
);
433 HTTP_CURL_OPT_STRING(RANDOM_FILE
);
434 HTTP_CURL_OPT_STRING(EGDSOCKET
);
441 /* disable SSL verification by default */
442 HTTP_CURL_OPT(SSL_VERIFYPEER
, 0);
443 HTTP_CURL_OPT(SSL_VERIFYHOST
, 0);
448 /* {{{ static inline http_curl_getinfo(CURL, HashTable *) */
449 static inline void _http_curl_getinfo(CURL
*ch
, HashTable
*info TSRMLS_DC
)
452 Z_ARRVAL(array
) = info
;
454 #define HTTP_CURL_INFO(I) HTTP_CURL_INFO_EX(I, I)
455 #define HTTP_CURL_INFO_EX(I, X) \
456 switch (CURLINFO_ ##I & ~CURLINFO_MASK) \
458 case CURLINFO_STRING: \
461 if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_ ##I, &c)) { \
462 add_assoc_string(&array, pretty_key(http_curl_copystr(#X), sizeof(#X)-1, 0, 0), c ? c : "", 1); \
467 case CURLINFO_DOUBLE: \
470 if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_ ##I, &d)) { \
471 add_assoc_double(&array, pretty_key(http_curl_copystr(#X), sizeof(#X)-1, 0, 0), d); \
476 case CURLINFO_LONG: \
479 if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_ ##I, &l)) { \
480 add_assoc_long(&array, pretty_key(http_curl_copystr(#X), sizeof(#X)-1, 0, 0), l); \
486 HTTP_CURL_INFO(EFFECTIVE_URL
);
488 #if LIBCURL_VERSION_NUM >= 0x070a07
489 HTTP_CURL_INFO(RESPONSE_CODE
);
491 HTTP_CURL_INFO_EX(HTTP_CODE
, RESPONSE_CODE
);
493 HTTP_CURL_INFO(HTTP_CONNECTCODE
);
495 #if LIBCURL_VERSION_NUM >= 0x070500
496 HTTP_CURL_INFO(FILETIME
);
498 HTTP_CURL_INFO(TOTAL_TIME
);
499 HTTP_CURL_INFO(NAMELOOKUP_TIME
);
500 HTTP_CURL_INFO(CONNECT_TIME
);
501 HTTP_CURL_INFO(PRETRANSFER_TIME
);
502 HTTP_CURL_INFO(STARTTRANSFER_TIME
);
503 #if LIBCURL_VERSION_NUM >= 0x070907
504 HTTP_CURL_INFO(REDIRECT_TIME
);
505 HTTP_CURL_INFO(REDIRECT_COUNT
);
508 HTTP_CURL_INFO(SIZE_UPLOAD
);
509 HTTP_CURL_INFO(SIZE_DOWNLOAD
);
510 HTTP_CURL_INFO(SPEED_DOWNLOAD
);
511 HTTP_CURL_INFO(SPEED_UPLOAD
);
513 HTTP_CURL_INFO(HEADER_SIZE
);
514 HTTP_CURL_INFO(REQUEST_SIZE
);
516 HTTP_CURL_INFO(SSL_VERIFYRESULT
);
517 #if LIBCURL_VERSION_NUM >= 0x070c03
518 /*HTTP_CURL_INFO(SSL_ENGINES);
519 todo: CURLINFO_SLIST */
522 HTTP_CURL_INFO(CONTENT_LENGTH_DOWNLOAD
);
523 HTTP_CURL_INFO(CONTENT_LENGTH_UPLOAD
);
524 HTTP_CURL_INFO(CONTENT_TYPE
);
526 #if LIBCURL_VERSION_NUM >= 0x070a03
527 /*HTTP_CURL_INFO(PRIVATE);*/
530 #if LIBCURL_VERSION_NUM >= 0x070a08
531 HTTP_CURL_INFO(HTTPAUTH_AVAIL
);
532 HTTP_CURL_INFO(PROXYAUTH_AVAIL
);
535 #if LIBCURL_VERSION_NUM >= 0x070c02
536 /*HTTP_CURL_INFO(OS_ERRNO);*/
539 #if LIBCURL_VERSION_NUM >= 0x070c03
540 HTTP_CURL_INFO(NUM_CONNECTS
);
545 /* {{{ STATUS http_get_ex(CURL *, char *, HashTable *, HashTable *, phpstr *) */
546 PHP_HTTP_API STATUS
_http_get_ex(CURL
*ch
, const char *URL
, HashTable
*options
, HashTable
*info
, phpstr
*response TSRMLS_DC
)
548 zend_bool clean_curl
= 0;
550 http_curl_startup(ch
, clean_curl
, URL
, options
, response
);
551 curl_easy_setopt(ch
, CURLOPT_HTTPGET
, 1);
552 http_curl_perform(ch
, clean_curl
, response
);
555 http_curl_getinfo(ch
, info
);
558 http_curl_cleanup(ch
, clean_curl
, response
);
563 /* {{{ STATUS http_head_ex(CURL *, char *, HashTable *, HashTable *, phpstr *) */
564 PHP_HTTP_API STATUS
_http_head_ex(CURL
*ch
, const char *URL
, HashTable
*options
,HashTable
*info
, phpstr
*response TSRMLS_DC
)
566 zend_bool clean_curl
= 0;
568 http_curl_startup(ch
, clean_curl
, URL
, options
, response
);
569 curl_easy_setopt(ch
, CURLOPT_NOBODY
, 1);
570 http_curl_perform(ch
, clean_curl
, response
);
573 http_curl_getinfo(ch
, info
);
576 http_curl_cleanup(ch
, clean_curl
, response
);
581 /* {{{ STATUS http_post_data_ex(CURL *, char *, char *, size_t, HashTable *, HashTable *, phpstr *) */
582 PHP_HTTP_API STATUS
_http_post_data_ex(CURL
*ch
, const char *URL
, char *postdata
,
583 size_t postdata_len
, HashTable
*options
, HashTable
*info
, phpstr
*response TSRMLS_DC
)
585 zend_bool clean_curl
= 0;
587 http_curl_startup(ch
, clean_curl
, URL
, options
, response
);
588 curl_easy_setopt(ch
, CURLOPT_POST
, 1);
589 curl_easy_setopt(ch
, CURLOPT_POSTFIELDS
, postdata
);
590 curl_easy_setopt(ch
, CURLOPT_POSTFIELDSIZE
, postdata_len
);
591 http_curl_perform(ch
, clean_curl
, response
);
594 http_curl_getinfo(ch
, info
);
597 http_curl_cleanup(ch
, clean_curl
, response
);
603 /* {{{ STATUS http_post_array_ex(CURL *, char *, HashTable *, HashTable *, HashTable *, phpstr *) */
604 PHP_HTTP_API STATUS
_http_post_array_ex(CURL
*ch
, const char *URL
, HashTable
*postarray
,
605 HashTable
*options
, HashTable
*info
, phpstr
*response TSRMLS_DC
)
611 if (SUCCESS
!= http_urlencode_hash_ex(postarray
, 1, NULL
, 0, &encoded
, &encoded_len
)) {
612 http_error(E_WARNING
, HTTP_E_ENCODE
, "Could not encode post data");
616 status
= http_post_data_ex(ch
, URL
, encoded
, encoded_len
, options
, info
, response
);
623 /* {{{ STATUS http_post_curldata_ex(CURL *, char *, curl_httppost *, HashTable *, HashTable *, phpstr *) */
624 PHP_HTTP_API STATUS
_http_post_curldata_ex(CURL
*ch
, const char *URL
, struct curl_httppost
*curldata
,
625 HashTable
*options
, HashTable
*info
, phpstr
*response TSRMLS_DC
)
627 zend_bool clean_curl
= 0;
629 http_curl_startup(ch
, clean_curl
, URL
, options
, response
);
630 curl_easy_setopt(ch
, CURLOPT_POST
, 1);
631 curl_easy_setopt(ch
, CURLOPT_HTTPPOST
, curldata
);
632 http_curl_perform(ch
, clean_curl
, response
);
635 http_curl_getinfo(ch
, info
);
638 http_curl_cleanup(ch
, clean_curl
, response
);
649 * vim600: noet sw=4 ts=4 fdm=marker
650 * vim<600: noet sw=4 ts=4