Hi,

I have to call a php file with POST request simultaneoulsy for some n times. For this I am using QThread and QHttp. Here is the code.

The thread part

Qt Code:
  1. for(int i = 0;i < noOfThreads; i++)
  2. {
  3. MyThread *t = new MyThread();
  4. connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
  5. t->run();
  6. }
To copy to clipboard, switch view to plain text mode 

The Http Part

Qt Code:
  1. op->clearPendingRequests();
  2. for(int i=0;i<n;i++) {
  3. QString log = GenerateLog();
  4. QHttpRequestHeader header( "POST", "/somephpfile.php" ) ;
  5. header.setValue( "Host", ipAddress ) ;
  6. header.setContentType( "application/x-www-form-urlencoded" ) ;
  7. http.request(header,QVariant(log).toByteArray());
  8. }
To copy to clipboard, switch view to plain text mode 

The above code is not working. Can someone please help?

Thanks.
Oh by the way here is my run () function

Qt Code:
  1. void MyThread::run()
  2. {
  3. mutex.lock();
  4. Http list(ipAddress, n);
  5. list.SetHost(ipAddress);
  6. list.info();
  7. mutex.unlock();
  8. }
To copy to clipboard, switch view to plain text mode 

I am new to both threading and http stuff. It would be great if some one can suggest some tutorial or help.

Thanks a lot.