making certain text variables....?

  • Anonymous - 2004-03-07

    Lets just say for example i want to retrieve the "Searching 4,285,199,774 web pages" text from the bottom of

    Then process it like this:

    Is something like this possible?

    • Anonymous - 2004-03-13

      Yes its actualyl quite easy with PHP.
      Use the string functions of PHP [strpos(), substr(), trim() etc]

      Some untested[!!!] code:
      $pos = strpos($mydata[0], "Searching");
      $mydata[0] = substr($mydata[0], $pos+10);
      $pos2 = strpos($mydata[0], "web pages");
      $mydata[0] = substr($mydata[0], 0, $pos2);
      $mydata[0] = trim($mydata[0]);
      $mydata[0] should now contain the number of searched pages.

      Use the function list from for details and other string-functions

    • Denzo

      Denzo - 2004-03-31

      Or try this and say $all is google's main page content.

      preg_match('/Searching (.*?) web pages/si', $all, $search);
      $number = $search[1];

      $number should now contain the data you want. (Untested aswell.) This code is maybe a bit easier to use and understand.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks