url.h 2.3 KB

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