HTTP URLENCODED 폼 인코딩 (http.table_to_form_urlencoded)
선언
인코딩된 폼 텍스트 = http.table_to_form_urlencoded(인코딩할 테이블)
매개변수
- 인코딩할 테이블
테이블
반환값
- 인코딩된 폼 텍스트
문자열
설명
이 함수는 20250313 이후 버전에서 사용할 수 있습니다.
예제
form = http.table_to_form_urlencoded{
num = 1,
str = '你好',
arr = {12, 34, '好'},
}
nLog(form) -- arr%5B0%5D=12&arr%5B1%5D=34&arr%5B2%5D=%E5%A5%BD&str=%E4%BD%A0%E5%A5%BD&num=1
c, h, r = http.get('https://httpbin.org/get?'..form, 10, {}, true) -- GET Query로 폼을 제출합니다. 마지막 인수가 true가 아니면 URL은 기본적으로 자동 Escape됩니다
nLog(r)
c, h, r = http.post('https://httpbin.org/post', 10, {}, form) -- POST로 폼 제출
nLog(r)