Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. HTTP request
Forum Updated to NodeBB v4.3 + New Features

HTTP request

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 692 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    t0msk
    wrote on last edited by
    #1

    Hello, I try to create HTTP request in Qt, this is my include section:

    #include "QHash"
    #include "QFile"
    #include "QCryptographicHash"
    #include "QtNetwork/QNetworkRequest"
    #include "QtNetwork/QNetworkAccessManager"
    #include "QUrl"
    #include "QUrlQuery"
    #include "QDebug"
    

    This is code:

    QUrl url("https://api.parse.com/1/login");
    QUrlQuery query;
    
    query.addQueryItem("username", "test");
    query.addQueryItem("password", "test");
    
    url.setQuery(query.query());
    
    QNetworkRequest request(url);
    
    request.setRawHeader("X-Parse-Application-Id", "myappid");
    request.setRawHeader("X-Parse-REST-API-Key", "myapikey");
    
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    manager->get(request);
    

    and there are errors:

    Errors

    What is wrong with it, please?

    Student who loves C/C++

    aha_1980A 1 Reply Last reply
    0
    • T t0msk

      Hello, I try to create HTTP request in Qt, this is my include section:

      #include "QHash"
      #include "QFile"
      #include "QCryptographicHash"
      #include "QtNetwork/QNetworkRequest"
      #include "QtNetwork/QNetworkAccessManager"
      #include "QUrl"
      #include "QUrlQuery"
      #include "QDebug"
      

      This is code:

      QUrl url("https://api.parse.com/1/login");
      QUrlQuery query;
      
      query.addQueryItem("username", "test");
      query.addQueryItem("password", "test");
      
      url.setQuery(query.query());
      
      QNetworkRequest request(url);
      
      request.setRawHeader("X-Parse-Application-Id", "myappid");
      request.setRawHeader("X-Parse-REST-API-Key", "myapikey");
      
      QNetworkAccessManager *manager = new QNetworkAccessManager(this);
      manager->get(request);
      

      and there are errors:

      Errors

      What is wrong with it, please?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi @t0msk,

      have you added QT += network in your .pro file?

      Qt has to stay free or it will die.

      T 1 Reply Last reply
      7
      • aha_1980A aha_1980

        hi @t0msk,

        have you added QT += network in your .pro file?

        T Offline
        T Offline
        t0msk
        wrote on last edited by
        #3

        @aha_1980 Thank you, I forgot :) When I need to add that libraries into .pro file?

        Student who loves C/C++

        K 1 Reply Last reply
        0
        • T t0msk

          @aha_1980 Thank you, I forgot :) When I need to add that libraries into .pro file?

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @t0msk said in HTTP request:

          @aha_1980 Thank you, I forgot :) When I need to add that libraries into .pro file?

          It is easy to forget libraries to add qmake. Most of us forget. However, it isa good advice to check the libraries setting when you get undefined references for Qt libs.

          Please mark your thread as "solved"

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved