<?php

  // 스누피 인클루드 (경로 주의 하세요)
  include_once './dist/Snoopy-2.0/Snoopy.class.php';
  // 스누피 객체 생성
  $snoopy = new snoopy;

  // 그리고 사이트를 호출하여
  $snoopy->fetch('http://www.yes24.com/24/Category/NewProduct');

  // 필요한 엘리먼트 호출
  preg_match(
              '/<ul class="clearfix" id="topBooksUl_001">(.*?)<\/ul>/is',
              iconv("euc-kr","utf-8",$snoopy->results),
              $product_list
            );
 ?>

<!DOCTYPE html>
<html lang="kt">
  <head>
    <meta charset="utf-8">
    <title>YES24 금주의 신간</title>
    <style>
      body{
        text-align: center;
          width: 600px;
      }

      li{
        text-align: center;
        list-style: none;
        float: left;
        width: 150px;
        height: 300px;
        margin: 5px;
        padding: 5px;
        background-color: #e9edf3;
      }
      p{
        font-size: 12px;
      }
    </style>
  </head>
  <body>
    <h3> YES24 금주의 신간 </h3>
    <?php
      // 원하는 부분만 출력하기
      echo $product_list[0];
     ?>
  </body>
</html>
