Analysing page content

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    Analysing page content

    Hi All,
    I'd like to be able to request a page from a server and then be able to
    analyse the content (rather than rendering it to the screen of my browser)
    in php. I guess this is a bit like how a robot works. I've got quite a lot
    of php knowledge already, but I can't think of how to do this.

    Has anybody any ideas on the types of functions or mechnisms I should be
    using for this?.

    Thanks in advance,
    Dave



  • adlerweb

    #2
    Re: Analysing page content

    Dave schrieb:
    I'd like to be able to request a page from a server and then be able to
    analyse the content (rather than rendering it to the screen of my browser)
    in php. I guess this is a bit like how a robot works. I've got quite a lot
    of php knowledge already, but I can't think of how to do this.
    Well. fsockopen/fwrite/fget or Curl for your connection and then regex
    should help to get the content into a usable form.

    Comment

    • Krustov

      #3
      Re: Analysing page content

      <comp.lang.ph p>
      <Dave>
      <Wed, 22 Nov 2006 14:13:06 -0000>
      <456457ef$1_1@g lkas0286.greenl nk.net>
      I'd like to be able to request a page from a server and then be able to
      analyse the content (rather than rendering it to the screen of my browser)
      in php. I guess this is a bit like how a robot works. I've got quite a lot
      of php knowledge already, but I can't think of how to do this.
      >
      Has anybody any ideas on the types of functions or mechnisms I should be
      using for this?.
      >
      <?php

      $ganja="http://www.yourdomain. com";

      $handle=fopen($ ganja,"rb"); $contents='';
      while (!feof($handle) ) {$contents .= fread($handle,8 192);}
      fclose($handle) ;

      $whatever=strip _tags($contents );

      $filename="stor e/demo.php";
      $fp=fopen($file name,"w"); fwrite ($fp,$whatever) ; fwrite ($fp,"\n");
      fclose($fp);

      ?>

      The above will grab the webpage and strip the html tags before saving it
      as a text file .

      Comment

      Working...