Solved How can I get things from website
-
-
@victor-wang What does fail mean? Do you get 500?
-
@victor-wang If you do not want to send all request in parallel you can do it one after another.
-
@jsulm
Yes, it will show 500.how to do that?
Could you teach me?Or can i do 5 times and another 5 times.
-
@victor-wang Put all URLs you want to get in a list.
Write a method which takes next URL from that list and sends a request.
Call this method in your button slot.
In the finished() slot you call this method again after handling current response if the list is not empty. -
@jsulm
Sorry it is too abstract for me,
Did you have an example? -
@victor-wang No, I don't have an example.
What is abstract here? I gave you a quite complete description.
What exactly is not clear? -
@jsulm
I don't know how to do it in the list and give a request.
I assume that i had a method function called getUrl();
And i will called it in the button.
When the replyFinished() slot is called from button.
Then i will call getUrl() again in the replyFinished() slot.I this what you mean?
-
//In your class: QList<QString> list; // In your button slot list << "URL1" << "URL2"<<...; sendNextRequest(); void sendNextRequest() { QString url = list.first(); list.removeFirst(); // Send request } // In your finished() slot // Handle current request ... if (list.size() > 0) sendNextRequest();
-
Is the void sendNextRequest() able to put in the button slot?
When do i call my
manager->get(QNetworkRequest(QUrl(url)));
Is the finished() slot same as my replyFinished() slot?
-
@victor-wang Yes, you call void sendNextRequest() in the button slot as any other method.
You callmanager->get(QNetworkRequest(QUrl(url)));
in void sendNextRequest() as I already said.
finished() signal is same except for these two lines (as I already said):if (list.size() > 0) sendNextRequest();
-
Thank you i had solve the problem
Thank you so much!!!!