Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    2
    3
    1185
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      Zain last edited by

      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

      1 Reply Last reply Reply Quote 0
      • C
        Code_ReaQtor last edited by

        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.

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply Reply Quote 0
        • Z
          Zain last edited by

          @ 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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post