Here are the solutions:
<erl>
out(A)->
Values = yaws_api:parse_query(A),
Value1 = proplists:get_value("Key1",Values),
Value2 = proplists:get_value("Key2",Values),
%% then do anything with them ....
%% ....
{html,"Json Data or HTML tags or XML data or string of data"}.
%% or {ehtml,[{p,[],""}]}.
<erl>
More information here: http://yaws.hyber.org/query.yaws
OR
<erl>
out(A)->
Value1 = yaws_api:queryvar(A,"Key1"),
Value2 = yaws_api:queryvar(A,"Key2"),
%% Need to be careful here
%% if the value aint found, the
%% variable will contain an atom 'undefined'
%% then do anything with them ....
%% ....
{html,"Json Data or HTML tags or XML data or string of data"}.
%% or {ehtml,[{p,[],""}]}.
<erl>
OR
<erl>
out(A)->
Value1 = yaws_api:getvar(A,"Key1"),
Value2 = yaws_api:getvar(A,"Key2"),
%% Need to be careful here
%% if the value aint found, the
%% variable will contain an atom 'undefined'
%% then do anything with them ....
%% ....
{html,"Json Data or HTML tags or XML data or string of data"}.
%% or {ehtml,[{p,[],""}]}.
<erl>
Read more on Module: yaws_api.erl
*NOTE * avoid using the last option (getvar/2
) because it first checks the POST data and then also checks the GET data, looking for your specified parameter. It should only be used when you are not sure wether the parameter is coming along the GET or POST request data.