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. [SOLVED] Params in URL with QNetworkAccessManager
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Params in URL with QNetworkAccessManager

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.8k 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.
  • B Offline
    B Offline
    beowulf
    wrote on last edited by
    #1

    @ QNetworkAccessManager *manager = new QNetworkAccessManager(this);

    QUrl url("http://localhost/request.php");
    
    QNetworkRequest request(url);
    
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    
    QUrl params;
    
    params.addQueryItem("n", "friend");
    
    manager->post(request, params.encodedQuery());@
    

    Not passing the parameter "n" including the site gives an error accusing that.

    PHP:
    @Notice: Undefined index: n in C:\wamp\www\request.php on line 3@

    -- 0x00

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake007
      wrote on last edited by
      #2

      Are you using POST or GET in your php script?


      Code is poetry

      1 Reply Last reply
      0
      • B Offline
        B Offline
        beowulf
        wrote on last edited by
        #3

        $_GET

        -- 0x00

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jake007
          wrote on last edited by
          #4

          If I understood documentation correctly, you're posting data in a request header (POST), and not setting it in URL, from where $_GET reads it.
          Try reading from post ($_POST).


          Code is poetry

          1 Reply Last reply
          0

          • Login

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