Screen Scrape Issue preg_match

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cainwebdesign@gmail.com

    Screen Scrape Issue preg_match

    I need to create a simple page to find the .gif file below from the
    page below. No matter what I try it doesn't work.... Any ideas?

    Toys”R”Us is the leading kids store for all toys, dolls, action figures, learning games, building blocks and more. C'mon, Let's Play!



    prod_AddtoCart. gif

  • Rik

    #2
    Re: Screen Scrape Issue preg_match

    cainwebdesign@g mail.com wrote:
    I need to create a simple page to find the .gif file below from the
    page below. No matter what I try it doesn't work.... Any ideas?
    >
    Toys”R”Us is the leading kids store for all toys, dolls, action figures, learning games, building blocks and more. C'mon, Let's Play!

    >
    >
    prod_AddtoCart. gif
    preg_match('|<d iv[^>]*?id="toShow"[^>]*>.*?<img[^>]*?src="([^"]*)"|si',$htm
    l,$match);
    $src = $match[1];

    --
    Grtz,

    Rik Wasmus


    Comment

    • cainwebdesign@gmail.com

      #3
      Re: Screen Scrape Issue preg_match

      Rik,
      Thanks but can you take a quick look, i still can see to get it to
      work.

      <?php

      $html =
      file_get_conten ts('http://www.toysrus.com/product/index.jsp?produ ctId=2327085');

      preg_match('|<d iv[^>]*?id="toShow"[^>]*>.*?<img[^>]*?src="([^"]*)"|si',$html,$ match);


      $src = $match[1];

      echo $src;




      ?>


      Rik wrote:
      cainwebdesign@g mail.com wrote:
      I need to create a simple page to find the .gif file below from the
      page below. No matter what I try it doesn't work.... Any ideas?

      Toys”R”Us is the leading kids store for all toys, dolls, action figures, learning games, building blocks and more. C'mon, Let's Play!



      prod_AddtoCart. gif
      >
      preg_match('|<d iv[^>]*?id="toShow"[^>]*>.*?<img[^>]*?src="([^"]*)"|si',$htm
      l,$match);
      $src = $match[1];
      >
      --
      Grtz,
      >
      Rik Wasmus

      Comment

      • Rik

        #4
        Re: Screen Scrape Issue preg_match

        cainwebdesign@g mail.com wrote:
        Rik,
        Thanks but can you take a quick look, i still can see to get it to
        work.

        The reason is as simple as evil.

        When opening it with PHP, the page terminates prematurely on:
        <!-- useragent: null -->

        They rely on user-agent detection to build the rest of their page, and
        don't revert to anything if it's not recognized.

        To gather the HTML, you're best of using CURL, and fake a User-Agent.
        --
        Rik Wasmus


        Comment

        • cainwebdesign@gmail.com

          #5
          Re: Screen Scrape Issue preg_match

          Rik,
          Would you be interested in doing this for me? I can pay you through
          paypal?

          You can respond through here and I can then contact you through your
          email attached?

          Rik wrote:
          cainwebdesign@g mail.com wrote:
          Rik,
          Thanks but can you take a quick look, i still can see to get it to
          work.
          >
          >
          The reason is as simple as evil.
          >
          When opening it with PHP, the page terminates prematurely on:
          <!-- useragent: null -->
          >
          They rely on user-agent detection to build the rest of their page, and
          don't revert to anything if it's not recognized.
          >
          To gather the HTML, you're best of using CURL, and fake a User-Agent.
          --
          Rik Wasmus

          Comment

          Working...