Ok, I'm trying this way:

Qt Code:
  1. QString myHost("www.google.com");
  2. int myPort = 80;
  3.  
  4. //this function establishes connection and returns immediately
  5. m_pSocket->connectToHost(myHost, myPort);
  6. connect(m_pSocket, SIGNAL(connected()), this, SLOT(connectedSlot()));
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void CMainWindow::connectedSlot() {
  2. QString input = "GET /index.php HTTP/1.1\n\n";
  3. if(m_pSocket->state() == QAbstractSocket::ConnectedState) {
  4. QTextStream stream(m_pSocket);
  5. stream << input;
  6. }
  7.  
  8. QString text;
  9. while(m_pSocket->canReadLine()) {
  10. text += m_pSocket->readLine();
  11. }
  12.  
  13. QTextStream output(stdout);
  14. QString enteredCommand = text;
  15. output >> text;
  16. }
To copy to clipboard, switch view to plain text mode 

I'm calling this slot when the connecter() signal occurs, still does not work!