<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[post with qt]]></title><description><![CDATA[<p dir="auto">Hi<br />
I am trying to make a post using qt with the following code:</p>
<p dir="auto">QNetworkAccessManager manager;</p>
<pre><code>QUrl url("http://192.168.4.1/post");
QNetworkRequest request(url);

request.setRawHeader("Content-Type", "text/plain");

QByteArray data("Hi");
QNetworkReply *reply = manager.post(request, data);

if(reply-&gt;error()){
    qDebug() &lt;&lt; reply-&gt;errorString();
}

connect(reply, &amp;QIODevice::readyRead, this, [=] {
    qDebug() &lt;&lt; "Reply: " &lt;&lt; reply-&gt;readAll();
});
</code></pre>
<p dir="auto">The thing is that my server don't reply so i don´t know if I am posting with a incorrect format or if it is another problem.</p>
<p dir="auto">When I use postman it works just fine!</p>
<p dir="auto">The curl code with postman is this one:<br />
curl --location --request POST '<a href="http://192.168.4.1/post" target="_blank" rel="noopener noreferrer nofollow ugc">http://192.168.4.1/post</a>' <br />
--header 'Content-Type: text/plain' <br />
--data-raw 'Hi'</p>
]]></description><link>https://forum.qt.io/topic/109973/post-with-qt</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 02:58:49 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/109973.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Dec 2019 15:07:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to post with qt on Fri, 20 Dec 2019 18:20:49 GMT]]></title><description><![CDATA[<p dir="auto">Try out:</p>
<pre><code>QUrl url("http://192.168.4.1/post");
QNetworkRequest request(url);

request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

QUrlQuery urlq;
urlq.addQueryItem ("Hi", "");

QNetworkReply *reply = manager.post(request, urlq.toString (QUrl::FullyEncoded).toUtf8 ());

while (!reply-&gt;isFinished())
{
	qApp-&gt;processEvents();
}

if(reply-&gt;error ()) qDebug ()&lt;&lt;reply-&gt;error();
else qDebug ()&lt;&lt;reply-&gt;readAll();

reply-&gt;deleteLater ();

</code></pre>
]]></description><link>https://forum.qt.io/post/568512</link><guid isPermaLink="true">https://forum.qt.io/post/568512</guid><dc:creator><![CDATA[Lemat]]></dc:creator><pubDate>Fri, 20 Dec 2019 18:20:49 GMT</pubDate></item></channel></rss>