c++ - Qt QUrlQuery param split -


i use qt v5.5. need http request this

qurlquery urlquery; urlquery.setquery("https://lalala.com/login"); urlquery.addqueryitem("submit", ""); urlquery.addqueryitem("email", "email@email.com"); urlquery.addqueryitem("pass", "unbelievable_password"); 

when call urlquery.query(); url

"https://lalala.com/login&submit=&email=email@email.com&pass=unbelievable_password" 

the param "submit" first param, need use '?' split param name, param split '&'.

you want url qurl, add query items on -- , not have url query item itself!

qurl url("https://www.foo.com");  qurlquery query; query.addqueryitem("email", "foo@bar.com"); query.addqueryitem("pass", "secret");  url.setquery(query);  qdebug() << url; 

correctly prints

qurl("https://www.foo.com?email=foo@bar.com&pass=secret") 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -