url updated

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yang Li Ke

    url updated

    What is the best way to know if a website was updated using php?

    I tried maybe using the last modified date
    but it seems that some sites dont have that
    info.

    Thank you all for your comments
    --
    Yang


  • Pedro Graca

    #2
    Re: url updated

    Yang Li Ke wrote:[color=blue]
    > What is the best way to know if a website was updated using php?
    >
    > I tried maybe using the last modified date
    > but it seems that some sites dont have that
    > info.[/color]

    I think your safer bet would be to save a copy of the page locally and
    compare it to the page on the server.
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • CountScubula

      #3
      Re: url updated

      "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
      news:R0jMb.3592 $881.302793@new s20.bellglobal. com...[color=blue]
      > What is the best way to know if a website was updated using php?
      >
      > I tried maybe using the last modified date
      > but it seems that some sites dont have that
      > info.
      >
      > Thank you all for your comments
      > --
      > Yang
      >
      >[/color]

      Grab the page, and run an md5 on the contents. save that, and check against
      it.

      however, any dynamic content such as the time, weather info, or number of
      visitors, etc... will break the
      comparison.



      $prevCheck = "4410ec34d9e6c1 a68100ca0ce033f b17";

      $page = file(http://www.google.com);

      $pageSum = md5($page);

      if ($pageSum != $prevCheck)
      print "Page changed\n";




      --
      Mike Bradley
      http://www.gzentools.com -- free online php tools


      Comment

      • Pedro Graca

        #4
        Re: url updated

        CountScubula wrote:[color=blue]
        > $page = file(http://www.google.com);
        >
        > $pageSum = md5($page);[/color]

        Sorry Mike :)
        md5($array) does *not* do what you expect !!

        cat xx.php
        #v+
        <?php
        $x=array();
        echo md5($x), "\n";
        $x[] = 1;
        echo md5($x), "\n";
        $x[] = 2;
        echo md5($x), "\n";
        $x[] = 3;
        echo md5($x), "\n";
        $x[] = 4;
        echo md5($x), "\n";
        $x[] = 5;
        echo md5($x), "\n";
        print_r($x);
        ?>
        #v-

        the output is
        4410ec34d9e6c1a 68100ca0ce033fb 17
        4410ec34d9e6c1a 68100ca0ce033fb 17
        4410ec34d9e6c1a 68100ca0ce033fb 17
        4410ec34d9e6c1a 68100ca0ce033fb 17
        4410ec34d9e6c1a 68100ca0ce033fb 17
        4410ec34d9e6c1a 68100ca0ce033fb 17
        Array
        (
        [0] => 1
        [1] => 2
        [2] => 3
        [3] => 4
        [4] => 5
        )
        --
        --= my mail box only accepts =--
        --= Content-Type: text/plain =--
        --= Size below 10001 bytes =--

        Comment

        • Pedro Graca

          #5
          Re: url updated

          CountScubula wrote:[color=blue]
          > $page = file(http://www.google.com);[/color]
          $page = file_get_conten ts($url); // or
          $page = implode('', file($url));[color=blue]
          >
          > $pageSum = md5($page);[/color]

          Nice Idea!
          --
          --= my mail box only accepts =--
          --= Content-Type: text/plain =--
          --= Size below 10001 bytes =--

          Comment

          • CountScubula

            #6
            Re: url updated

            "Pedro Graca" <hexkid@hotpop. com> wrote in message
            news:btsji7$ak9 dr$1@ID-203069.news.uni-berlin.de...[color=blue]
            > CountScubula wrote:[color=green]
            > > $page = file(http://www.google.com);
            > >
            > > $pageSum = md5($page);[/color]
            >
            > Sorry Mike :)
            > md5($array) does *not* do what you expect !!
            >[/color]

            Ah yes, my fault,

            should read:

            $prevCheck = "b5efa612c52218 17eeb56ab6166b2 f48";

            $page = implode("",file ("http://www.google.com" ));
            $pageSum = md5($page);



            --
            Mike Bradley
            http://www.gzentools.com -- free online php tools


            Comment

            • CountScubula

              #7
              Re: url updated

              "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
              news:R0jMb.3592 $881.302793@new s20.bellglobal. com...[color=blue]
              > What is the best way to know if a website was updated using php?
              >
              > I tried maybe using the last modified date
              > but it seems that some sites dont have that
              > info.
              >
              > Thank you all for your comments
              > --
              > Yang
              >
              >[/color]

              Ok, try this:



              --
              Mike Bradley
              http://www.gzentools.com -- free online php tools


              Comment

              Working...