php 파싱 관련해서 질문드려요! 정보
JavaScript php 파싱 관련해서 질문드려요!본문
http://heartbrea.kr/random.php 에 들어갈 경우, 랜덤으로 BGM swf와 swf주소를 띄워줍니다.
전 그 띄워주는 swf주소를 파싱하여 출력하고 싶어요!
그래서 Snoopy.Class 를 이용해서 아래와 같이 작성 후에 파싱을 시도했는데
<?php
include_once 'Snoopy.class.php';
$site_url="http://heartbrea.kr/random.php";
$snoopy=new snoopy;
$snoopy->fetch($site_url);
$txt = $snoopy->results;
$ex = explode("<th>bgm주소: </th><td><a href=",$txt);
$test = explode("onclick=",$ex[1]);
print $test[0];
?>
아무것도 뜨지 않았어요.
혹시라도 저 주소가 변경되서 다른곳으로 이동된다고 하면 그 이동된 주소로 시도하는 방법이나 (있을지 모르지만)iframe을 이용한 파싱방법이 있다면 알려주세요..!
아니면 성공적으로 작동하는 것이라도 알려주세요..<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
전 그 띄워주는 swf주소를 파싱하여 출력하고 싶어요!
그래서 Snoopy.Class 를 이용해서 아래와 같이 작성 후에 파싱을 시도했는데
<?php
include_once 'Snoopy.class.php';
$site_url="http://heartbrea.kr/random.php";
$snoopy=new snoopy;
$snoopy->fetch($site_url);
$txt = $snoopy->results;
$ex = explode("<th>bgm주소: </th><td><a href=",$txt);
$test = explode("onclick=",$ex[1]);
print $test[0];
?>
아무것도 뜨지 않았어요.
혹시라도 저 주소가 변경되서 다른곳으로 이동된다고 하면 그 이동된 주소로 시도하는 방법이나 (있을지 모르지만)iframe을 이용한 파싱방법이 있다면 알려주세요..!
아니면 성공적으로 작동하는 것이라도 알려주세요..<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
추천
0
0
댓글 4개
꼭좀 부탁드려요.
$szServer = "heartbrea.kr";
$fp = fsockopen($szServer, 80, $errorno, $errstr, 30);
$string = "";
if(!$fp)
{
echo "$errstr ($errno)<br>\n";
}
else
{
fputs($fp, "GET /random.php HTTP/1.1\r\n");
fputs($fp, "Host: heartbrea.kr\r\n");
fputs($fp, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13\r\n");
fputs($fp, "Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n\r\n");
fwrite($fp, $out);
while(!feof($fp)) {
$string .= fgets($fp, 128);
}
preg_match_all("/location.href\s*=\s*[\"'](.*?)[\"']/", $string , $pregs);
echo $pregs[1][0];
fclose($fp);
}
$fp = fsockopen($szServer, 80, $errorno, $errstr, 30);
$string = "";
if(!$fp)
{
echo "$errstr ($errno)<br>\n";
}
else
{
fputs($fp, "GET /random.php HTTP/1.1\r\n");
fputs($fp, "Host: heartbrea.kr\r\n");
fputs($fp, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13\r\n");
fputs($fp, "Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n\r\n");
fwrite($fp, $out);
while(!feof($fp)) {
$string .= fgets($fp, 128);
}
preg_match_all("/location.href\s*=\s*[\"'](.*?)[\"']/", $string , $pregs);
echo $pregs[1][0];
fclose($fp);
}
소켓을 통해 얻어와봤습니다,
감사해요, 여기에 스누피 연동하면 되겠네요!
근데 속도가 조금 ㅠㅠ
근데 속도가 조금 ㅠㅠ