1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
void Decrypt::recherche(){
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName("172.16.30.23");
proxy.setPort(8080);
QNetworkProxy::setApplicationProxy (proxy);
QNetworkRequest requete(QUrl("http://www.boursorama.com/cours.phtml"));
QNetworkAccessManager *m = new QNetworkAccessManager;
m->setProxy (proxy);
requete.setRawHeader("User-Agent", "Web-sniffer/1.0.36 (+http://web-sniffer.net/)[");
requete.setRawHeader("Accept-Language", "fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3");
requete.setRawHeader("Accept-Encoding", "gzip");
requete.setRawHeader("Accept-Charset", "ISO-8859-1,UTF-8;q=0.7,*;q=0.7");
requete.setRawHeader("Content-type", "application/x-www-form-urlencoded");
QNetworkReply *r = m->post(requete, "symbole=1rPCAC");
connect(r, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(messageErreur(QNetworkReply::NetworkError)));
// On attend que le signal finished soit reu
QEventLoop loop;
QObject::connect(r, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
// Fin de l'attente
bool verrou = true;
int cpt = 0;
while (!r->atEnd () && verrou) {
cpt++;
str = r->readLine ();
QMessageBox::information(this, "Nul", str);
if (str.contains (texteEdit->text())){
//str = "Texte trouv en ligne : " + QString::number (cpt);
//QMessageBox::information(this, "Youpi", str);
verrou = false;
}
}
if (verrou){
QMessageBox::information(this, "Nul", "Pas de chaine trouv !");
} else {
str = r->readLine ();
str.remove(QRegExp("[><]."));
QMessageBox::information(this, "Youpi", str);
str = r->readLine ();
QMessageBox::information(this, "Youpi", str);
}
} |
Partager