스누피 파싱 예제 > php

본문 바로가기

php

스누피 파싱 예제

작성일 20-04-29 10:08

페이지 정보

작성자서방님 조회 457회 댓글 0건

본문

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
include "../lib/Snoopy.class.php";
$snoopy = new snoopy;

// 알파 전국 체인 현황
$url = "http://www.alpha.co.kr/customer/chain/chainSearchList.do?cPage=37&searchWord=&searchSmartcon=";
$snoopy->fetch($url); //긁을주소
$txt = $snoopy->results;


$tt = "|<td class=\"shop\">(.*?)</td>|";
$tt2 = "|<td class=\"subject\">(.*?)</td>|";
$tt3 = "|<td class=\"tel\">(.*?)</td>|";
$tt4 = "|<td class=\"fax\">(.*?)</td>|";

preg_match_all($tt,$txt,$content);
preg_match_all($tt2,$txt,$content2);
preg_match_all($tt3,$txt,$content3);
preg_match_all($tt4,$txt,$content4);
?>

<table>
<?
for($i=0;$i<count($content[0]);$i++) {
?>
	<tr>
		<td><?=$content[0][$i]?></td>
		<td><?=$content2[0][$i]?></td>
		<td><?=$content3[0][$i]?></td>
		<td><?=$content4[0][$i]?></td>
	</tr>
<?
}
?>
</table>

댓글목록

등록된 댓글이 없습니다.

게시물 검색
Copyright © 서방님.kr All rights reserved.
PC 버전으로 보기