url.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 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. #ifndef URL_H
  19. #define URL_H
  20. typedef struct php_url {
  21. zend_string *scheme;
  22. zend_string *user;
  23. zend_string *pass;
  24. zend_string *host;
  25. unsigned short port;
  26. zend_string *path;
  27. zend_string *query;
  28. zend_string *fragment;
  29. } php_url;
  30. PHPAPI void php_url_free(php_url *theurl);
  31. PHPAPI php_url *php_url_parse(char const *str);
  32. PHPAPI php_url *php_url_parse_ex(char const *str, size_t length);
  33. PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, zend_bool *has_port);
  34. PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */
  35. PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */
  36. PHPAPI zend_string *php_url_encode(char const *s, size_t len);
  37. PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len);
  38. PHPAPI char *php_replace_controlchars_ex(char *str, size_t len);
  39. PHP_FUNCTION(parse_url);
  40. PHP_FUNCTION(urlencode);
  41. PHP_FUNCTION(urldecode);
  42. PHP_FUNCTION(rawurlencode);
  43. PHP_FUNCTION(rawurldecode);
  44. PHP_FUNCTION(get_headers);
  45. #define PHP_URL_SCHEME 0
  46. #define PHP_URL_HOST 1
  47. #define PHP_URL_PORT 2
  48. #define PHP_URL_USER 3
  49. #define PHP_URL_PASS 4
  50. #define PHP_URL_PATH 5
  51. #define PHP_URL_QUERY 6
  52. #define PHP_URL_FRAGMENT 7
  53. #define PHP_QUERY_RFC1738 1
  54. #define PHP_QUERY_RFC3986 2
  55. #endif /* URL_H */
  56. /*
  57. * Local variables:
  58. * tab-width: 4
  59. * c-basic-offset: 4
  60. * End:
  61. */