Post format
-
my widget code:
-
// Setup the webservice url QUrlQuery query; query.addQueryItem("myQt", "isCute"); QUrl url("http://192.168.1.1/"); url.setQuery(query); QNetworkRequest request(url); request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded"); QString str="QtQtQtQt"; manager->post(request,str.toLocal8Bit());
my information using my Code on server side:
- LocalBuf=
POST /?myQt=isCute HTTP/1.1
Content-Type := application/x-www-form-urlencoded
Content-Length: 13
Connecton:Keep-Alive
Accept-Encoding:gzip, deflate
Accept-Language:zh-TW,en,*
User-Argent:Mozilla/5.0
Host:192.168.1.1
my question is :
1.I can't find my str. Does anybody know why? When will it be send?2.my information using post by submitting button in html on server side:
- LocalBuf=
POST HTTP/1.1
Content-Length: 13
Content-Type := application/x-www-form-urlencoded
Host: 192.168.1.1
Connecton:Keep-Alive
myQt=isCute
The information(the position for myQt=isCute) is different. Why? which is correct?
3.How to change my code if I wnat to get the same information on server side?
-
-
@mkdh said:
url.setQuery(query);
Using
setQuery
you're setting the query of your URL so it's OK.2.my information using post by submitting button in html on server side:
how do you send info form HTML ??
3.How to change my code if I want to get the same information on server side?
You must send data as part of the request and not in the URL
-
Hi @mcosta ,
view-source:http://192.168.1.1
<html><head><SCRIPT language=Javascript src="<% getLangInfo("lang");%>"></SCRIPT><script>function onChangeSecType(){x=document.getElementById("sec");y=document.getElementById("pwd_row");if(x.value == "open"){y.style.display="none";}else{y.style.display="block";}}</script><script>function onSubmitForm(){x=document.getElementById("Ssid");y=document.getElementById("pwd_row");z=document.getElementById("pwd");if(x.value.length>32){alert("SoftAP SSID is too long!(1-32)");return false;}if(y.style.display == "block"){if((z.value.length < 8)||(z.value.length>32)){alert("Password length is between 8 to 32");return false;}}}</script></head><BODY onLoad="onChangeSecType()"> <form name="form" method="post" onsubmit="return onSubmitForm()"><table width="500"><tr><td colspan="2" style="background-color:#FFA500;text-align:center;"><h2>Realtek SoftAP Configuration</h2></td></tr><tr><td style="background-color:#FFD700;width:100px;"><b>SoftAP SSID:</b><br></td><td style="background-color:#eeeeee;height:30px;width:400px;"><input type="text" name="Ssid" id="Ssid" value="SSID_ZH"><br></td></tr><tr><td style="background-color:#FFD700;width:100px;"><b>Security Type:</b><br></td><td style="background-color:#eeeeee;height:30px;"><select name="Security Type" id="sec" onChange=onChangeSecType()><option value="open" >OPEN</option><option value="wpa2-aes" selected>WPA2-AES</option></select></td></tr><tr id="pwd_row"><td style="background-color:#FFD700;width:100px;"><b>Password:</b><br></td><td style="background-color:#eeeeee;height:30px;"><input type="text" name="Password" id="pwd" value="12345678" ><br></td></tr><tr><td style="background-color:#FFD700;width:100px;"><b>Channel:</b><br></td><td style="background-color:#eeeeee;height:30px;"><select name="Channel"><option value="1" >1</option><option value="2" >2</option><option value="3" >3</option><option value="4" >4</option><option value="5" >5</option><option value="6" selected>6</option><option value="7" >7</option><option value="8" >8</option><option value="9" >9</option><option value="10" >10</option><option value="11" >11</option></select></td></tr><tr><td colspan="2" style="background-color:#FFD700;text-align:center;height:40px"><input type="submit" value="Submit"><br></td></tr><tr><td colspan="2" style="background-color:#FFA500;text-align:center;">Copyright � realtek.com</td></tr></table> </form></BODY> </html>
I don't know how to let my code auto-indent format on this forum. ^.^!
-
By the way,
On server side, I can get my request value using my widget code to post .
I'm just confused as why the information is different from the result by clicking the submit button on html... ="=