xref: /PHP-7.4/ext/standard/url.h (revision 2cab085b)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) The PHP Group                                          |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author: Jim Winstead <jimw@php.net>                                  |
16    +----------------------------------------------------------------------+
17  */
18 
19 #ifndef URL_H
20 #define URL_H
21 
22 typedef struct php_url {
23 	zend_string *scheme;
24 	zend_string *user;
25 	zend_string *pass;
26 	zend_string *host;
27 	unsigned short port;
28 	zend_string *path;
29 	zend_string *query;
30 	zend_string *fragment;
31 } php_url;
32 
33 PHPAPI void php_url_free(php_url *theurl);
34 PHPAPI php_url *php_url_parse(char const *str);
35 PHPAPI php_url *php_url_parse_ex(char const *str, size_t length);
36 PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, zend_bool *has_port);
37 PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */
38 PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */
39 PHPAPI zend_string *php_url_encode(char const *s, size_t len);
40 PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len);
41 PHPAPI char *php_replace_controlchars_ex(char *str, size_t len);
42 
43 PHP_FUNCTION(parse_url);
44 PHP_FUNCTION(urlencode);
45 PHP_FUNCTION(urldecode);
46 PHP_FUNCTION(rawurlencode);
47 PHP_FUNCTION(rawurldecode);
48 PHP_FUNCTION(get_headers);
49 
50 #define PHP_URL_SCHEME 0
51 #define PHP_URL_HOST 1
52 #define PHP_URL_PORT 2
53 #define PHP_URL_USER 3
54 #define PHP_URL_PASS 4
55 #define PHP_URL_PATH 5
56 #define PHP_URL_QUERY 6
57 #define PHP_URL_FRAGMENT 7
58 
59 #define PHP_QUERY_RFC1738 1
60 #define PHP_QUERY_RFC3986 2
61 
62 #endif /* URL_H */
63