Jan. 22, 2019, 7:35 p.m.

QNetworkAccessManager && http

Я хочу отправить SMS из приложения с помощью SMS-провайдера через Интернет. Они позволяют мне отправлять сообщения, отправлять их в браузер: http://rest.esms.vn/MainService.svc/json/SendMult MonMessage_V4_get?
И у меня пока нет этого опыта, поэтому я хочу наглядный пример. Кто-нибудь может мне помочь?

Virtual hosting with 10 percent discount
Virtual hosting with 10 percent discount
EVILEG offers reliable hosting with a 10% discount for virtual hosting and 5% for VPS
4

Hello.

Maybe the English will be better for you? I think russian is not native language for you, or did I mistake?

Did I undesrtood rightly, that you mean this documentation ( SendMultipleMessage_V4_get ) ?

  • Jan. 23, 2019, 8:32 p.m.
  • (edited)

Sorry, my English is not very good too. I mean, I want to write an application to send messages from the computer, they allow me to send request HTTP: http://rest.esms.vn/MainService.svc/json/SendMultipleMessage_V4_get?Phone=09xxxx&Content=DemoeSMS&ApiKey=xxxx&SecretKey=xxxx&SmsType=2&Brandname=abcabc

This is very new to me,
I want to see some examples of it or something similar.

Sorry, my English is not very good too

It`s no problem. Just I think the English will be better for your understanding, because we will have more similar level in language.

I have several examples with QNetworkAccessManager:

I think, you can use part of code from this Qt/C++ - Lesson 041. JSON file – How to get from site and parsing it

Just you need make some changes here

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    networkManager = new QNetworkAccessManager();
    // Connect networkManager response to the handler
    connect(networkManager, &QNetworkAccessManager::finished, this, &Widget::onResult);
    // We get the data, namely JSON file from a site on a particular url
    networkManager->get(QNetworkRequest(QUrl("http://www.evileg.ru/it_example.json")));
}

For example

connect(networkManager, &QNetworkAccessManager::finished, this, &Widget::onResult);
// We get the data, namely JSON file from a site on a particular url
networkManager->get(QNetworkRequest(QUrl(QString("http://rest.esms.vn/MainService.svc/json/SendMultipleMessage_V4_get?Phone=%1&Content=%2&ApiKey=%3&SecretKey=%4&SmsType=%5&Brandname=%6").arg("09xxxx").arg("DemoeSMS").arg("xxxx").arg("xxxx").arg("2").arg("abcabc");

And make changes in onResult slot

void Widget::onResult(QNetworkReply *reply)
{
    if(!reply->error()){
        qDebug() << "No errors";
    }
    reply->deleteLater();
}
  • Jan. 24, 2019, 6:44 p.m.
  • (edited)

Thanks very much for your help. :D
i'll try it.

Comments

Only authorized users can post comments.
Please, Log in or Sign up
D
Aug. 16, 2019, 11:58 a.m.
Damir

C++ - Тест 003. Условия и циклы

  • Result:92points,
  • Rating points8
D
Aug. 16, 2019, 11:46 a.m.
Damir

C++ - Test 005. Structures and Classes

  • Result:75points,
  • Rating points2
u
Aug. 14, 2019, 1:55 p.m.
unrealproro

C++ - Test 005. Structures and Classes

  • Result:83points,
  • Rating points4
Last comments
Aug. 19, 2019, 6:41 a.m.
Andrej Jankovich

это проблема дистрибутива, попробуйте установить через пакетный менеджер snap Суть проблемы: libQt5Core которая лежит в дистрибутиве требует версию glibc >= 2.25 у вас видимо …
b
Aug. 18, 2019, 5:09 a.m.
bbb116

cqtdeployer /home/aleks/CQtDeployer/bin/cqtdeployer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /home/aleks/CQtDeployer/lib/libQt5Core.so.5) linux mint …
D
Aug. 17, 2019, 8:04 a.m.
Damir

github ChekableTView Правой групповая смена значения при перетаскивании левой как обычно.
Aug. 16, 2019, 12:03 p.m.
Evgenij Legotskoj

Потому, что в минуте 60 секунд
Aug. 16, 2019, 11:16 a.m.
Dmitrij

а почему делитель 60000, а не 1000?
Now discuss on the forum
Aug. 19, 2019, 10:29 a.m.
Aleksej Vnukov

я в дороге, по тому примеру что в есть выше вам чтоб заработало нужно примерно следующее ListModel{ id: list_model } в ListView добавить model:list_model там где кноп…
Aug. 19, 2019, 8:47 a.m.
Pavel K.

bool YourClass::chekIfEmpty(const QString& table) { return getCount(table) == 0;}int YourClass::getCount(const QString& table, const QString& where) { QString command =…
Aug. 19, 2019, 8:29 a.m.
Pavel K.

посмотрите тут , практически тоже самое делал(пробегал по документу). А так в принципе : QFile file(Path);if(file.exist){ file.open(QIODevice::WriteOnly); // ReadWrite for…
Aug. 19, 2019, 2:39 a.m.
grig_p

Здравствуйте! Хотелось бы в своем приложении сделать цетрализованную обработку исключительных ситуаций для их логирования. Переопределил метод notify(): static const int EC_MAINLOOP…
Aug. 15, 2019, 2:19 a.m.
Mihailll

Плюсы и qml отличаются, с++ логичней
Looking for a Job?
14,000.00 руб. - 40,000.00 руб.
Разработчик Qt
Annino, Moscow Oblast, Russia
5,000.00 руб. - 15,000.00 руб.
Дизайнер
Moskovskiy, Moscow, Russia
25,000.00 руб. - 30,000.00 руб.
Разработчик Qt/C++
Barnaul, Altai Krai, Russia

For registered users on the site there is a minimum amount of advertising

EVILEG
About
Services
© EVILEG 2015-2019
Recommend hosting TIMEWEB