How to Check Is Domain Indexed in Google from Qt application code



  • Hello All,

    I am developing an application in which i need to check for any website whether it is Indexed in Google or not.

    I have written following code on my button click slot.

    @ QNetworkAccessManager manager;
    QNetworkReply *reply234;
    QEventLoop loop2;

    QString googleUrl="http://www.google.com/search?q=site:msn.com";
    reply234 =manager.get(QNetworkRequest(QUrl(googleUrl)));
    

    connect(reply234, SIGNAL(finished()), &loop2, SLOT(quit()));
    loop2.exec();
    QString htmlOutputString= QString::fromUtf8(reply234->readAll());

    qDebug()<<"htmlOutputString :"<<htmlOutputString;
    @

    But I am getting in debugging window most of the time in @ htmlOutputString @ following result.

    "<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>302 Moved</TITLE></HEAD><BODY>
    <H1>302 Moved</H1>
    The document has moved
    <A HREF="http://www.google.com/sorry/?continue=http://www.google.com/search?q=site:msn.com">here</A>.
    </BODY></HTML>
    "

    And some time blank or just like this "".

    Any suggestion appreciated (better if code is included :) )

    Thanks in advance
    Zain



  • That is a captcha code to prevent any "bots" from accessing a site. Which means that you might have violated their "Rules" or "Terms of Service". I think the best way to access google is to use their APIs.... though I am not sure which of those APIs is what you need.



  • @ Code_ReaQtor

    Thanks for reply.But i don't think so need to use any google API to search damin indexing.
    Above same logic is working in Dot Net and Adobe Air Technologies.But not in QT .
    I think I am missing something.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.