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. QNetworkAccessManger get data
QtWS25 Last Chance

QNetworkAccessManger get data

Scheduled Pinned Locked Moved Solved General and Desktop
qt 6.0.1c++mingw
4 Posts 3 Posters 685 Views
  • 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.
  • E Offline
    E Offline
    ELEMENTICY
    wrote on 5 Mar 2021, 10:46 last edited by
    #1

    Hello,i posted a thread before about this. But the thread just gone from my profile or its deleted but didt giving me a reason. So i posted it again.

    How do i use QNetworkAccessManager to GET the data from a website?

    for example in python,we can use

    import requests
    accounts = requests.get("http://pastebin.com/raw/eukYLq2y");
    

    And we can get the data from the site

    but how do i do it in Qt C++ and make it in QString?
    I need it become QString becasue i wanna do this:

    #include <QNetworkAccessManager>
    QString input = ui->input->text();
    QString webdata = /*QString of website data*/;
    if(accounts.contains(input))
    {
        //Do code
    }
    else
    {
        ui->error->setText("Wrong input entered");
    }
    

    Please help,and please dont delete the thread.Thx.

    J P 2 Replies Last reply 5 Mar 2021, 11:02
    0
    • E ELEMENTICY
      5 Mar 2021, 10:46

      Hello,i posted a thread before about this. But the thread just gone from my profile or its deleted but didt giving me a reason. So i posted it again.

      How do i use QNetworkAccessManager to GET the data from a website?

      for example in python,we can use

      import requests
      accounts = requests.get("http://pastebin.com/raw/eukYLq2y");
      

      And we can get the data from the site

      but how do i do it in Qt C++ and make it in QString?
      I need it become QString becasue i wanna do this:

      #include <QNetworkAccessManager>
      QString input = ui->input->text();
      QString webdata = /*QString of website data*/;
      if(accounts.contains(input))
      {
          //Do code
      }
      else
      {
          ui->error->setText("Wrong input entered");
      }
      

      Please help,and please dont delete the thread.Thx.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 5 Mar 2021, 11:02 last edited by
      #2

      @ELEMENTICY You get QByteArray and can create a QString out of it by simply usinig https://doc.qt.io/qt-5/qstring.html#QString-8

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply 6 Mar 2021, 06:34
      2
      • E ELEMENTICY
        5 Mar 2021, 10:46

        Hello,i posted a thread before about this. But the thread just gone from my profile or its deleted but didt giving me a reason. So i posted it again.

        How do i use QNetworkAccessManager to GET the data from a website?

        for example in python,we can use

        import requests
        accounts = requests.get("http://pastebin.com/raw/eukYLq2y");
        

        And we can get the data from the site

        but how do i do it in Qt C++ and make it in QString?
        I need it become QString becasue i wanna do this:

        #include <QNetworkAccessManager>
        QString input = ui->input->text();
        QString webdata = /*QString of website data*/;
        if(accounts.contains(input))
        {
            //Do code
        }
        else
        {
            ui->error->setText("Wrong input entered");
        }
        

        Please help,and please dont delete the thread.Thx.

        P Offline
        P Offline
        Pablo J. Rogina
        wrote on 5 Mar 2021, 11:47 last edited by
        #3

        @ELEMENTICY Have you checked the Qt network examples, the simple HTTP client for instance?

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        1
        • J jsulm
          5 Mar 2021, 11:02

          @ELEMENTICY You get QByteArray and can create a QString out of it by simply usinig https://doc.qt.io/qt-5/qstring.html#QString-8

          E Offline
          E Offline
          ELEMENTICY
          wrote on 6 Mar 2021, 06:34 last edited by
          #4

          @jsulm Yoo,thanks bro

          1 Reply Last reply
          0

          1/4

          5 Mar 2021, 10:46

          • Login

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