'How to parse data in page and return to var using Nginx + Lua
can someone help resolve my issue, i'm using (openresty) nginx + lua, and I need using Lua parse html data between <p> and put parsed value to var
example: <p>Total Cost 100</p> >> $var
Solution 1:[1]
You might body_filter_by_lua_block directive, so there should be something like this (didn't test):
location / {
proxy_pass http://backend;
body_filter_by_lua_block {
ngx.arg[1] = ngx.arg[1]:gsub("<p.->(.-)</p>", "%1").
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
