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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -