Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:36:01+00:00 2026-05-20T09:36:01+00:00

I am using the following function to make a post request: bool NewAccountDialog::verifyAccount() {

  • 0

I am using the following function to make a post request:

bool NewAccountDialog::verifyAccount()
{
    QString loginURL = "https://accounts.craigslist.org/";
    QString USERAGENT = "Mozilla/Firefox 3.6.12";

    // This is all bullshit
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);

    QNetworkRequest request;
    request.setUrl(loginURL);
    request.setRawHeader("User-Agent", USERAGENT);

    QByteArray data;
    QUrl params;

    params.addQueryItem("inputEmailHandle", accountName->text());
    params.addQueryItem("inputPassword", accountPass->text());
    data.append(params.toString());
    //No idea what this does
    data.remove(0,1);

    QNetworkReply *reply = manager->post(request,data);

    // Parse reply

    return 1;
}

Obviously it’s incomplete, but it doesn’t compile giving me an error where I run request.setRawHeader() complaining there is no function that matches my call:

/home/brett/projects/CLPoster/CLPoster-build-desktop/../CLPoster/newaccountdialog.cpp:120:
error: no matching function for call to
QNetworkRequest::setRawHeader(const char [11], QString&)

It takes 2 QByteArrays as parameters, and the official example even passes it two strings:

 request.setRawHeader("Last-Modified", "Sun, 06 Nov 1994 08:49:37 GMT");

Not that it should matter, but I’ve tried that and still get the same error. Is my Qt broken?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:36:01+00:00Added an answer on May 20, 2026 at 9:36 am

    The problem is in the second parameter (USERAGENT). A QByteArray can be constructed from a char array, but not from a QString (see QByteArray‘s documentation). You need either to use QString::toAscii(), QString::toLatin1() or something similar, or to make USERAGENT a char*:

     const char* USERAGENT = "Mozilla/Firefox 3.6.12";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to make a ajax request. But how to configure
I'm using the following code to send POST request if validation passes. But it
I make an ajax request using jquery, this calls the following spring controller: @RequestMapping(value
I am using following function to load the page. I have loads of links
I am using following function. Whenever i call it that time it will increase
I want to print an integer number in binary mode using following function: #include
I am using the following function and code to try to get the size
I'm using the following function to load a remote image to an ImageView. The
I'm using the following function that changes a calendar selection at a set time
I am using the following function to loop through a couple of open CDB

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.