기업사이트 작업할때 IR관련 작업은 어떻게 하세요? 정보
기업사이트 작업할때 IR관련 작업은 어떻게 하세요?
본문
이번에 들어갈 작업에 기업 주가 정보 넣야 할거 같은데
이런 작업을 해본적이 없네요.
힌트라도 좀 주십시요 굽신굽신(__)(--)(__)
이런 작업을 해본적이 없네요.
힌트라도 좀 주십시요 굽신굽신(__)(--)(__)
추천
0
0
댓글 8개

http://114.207.246.213/start.php 재미로 스크래핑 해본겁니다..
하이닉스랑 삼성전자 두개 예제로 걸어놓았네요.. 팍X넷 실시간 데이터입니다.
뭐 이런거도 괜찮으시다믄 힌트를 드리지요
하이닉스랑 삼성전자 두개 예제로 걸어놓았네요.. 팍X넷 실시간 데이터입니다.
뭐 이런거도 괜찮으시다믄 힌트를 드리지요

다른곳에 적용된 사이트 보니 상장기업지원서비스라고 지원 해주는걸 iframe으로 가져 온거네요. 외부 사이트 연동 하는걸 별로 좋아 하지 않아 염치 없지만 힌트 좀 부탁드립니다.

실제 가져오는 부분 소스입니다.
get.php 등으로 저장하신후
get.php?jcode=종목코드 하시면 몇개정보 가져옵니다.
<?
//extract($_POST);
if( isset($_REQUEST["jcode"]) )
$jcode = $_REQUEST["jcode"];
else
$jcode = "";
$jcode = ( $jcode == "" ) ? "005930":$jcode;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://hyper.moneta.co.kr/fcgi-bin/DelayedCurrPrice7.fcgi?code='.$jcode.'&isReal=true');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$file_contents = curl_exec($ch);
$flag = "UP";
preg_match_all('/<h2>(.*)<\/h2>/U',$file_contents,$matches ) ;
$nowName = strip_tags($matches[1][0]);
preg_match_all('/<p>(.*)<\/p>/U',$file_contents,$matches ) ;
$nowTime = $matches[1][0];
preg_match_all('/<strong class="up">(.*)<\/strong>/U',$file_contents,$matches ) ;
if( isset($matches[1][0]) )
$nowPrice = ereg_replace("," , "", $matches[1][0]);
else
$nowPrice = "";
if( $nowPrice == "" ) {
preg_match_all('/<strong class="down">(.*)<\/strong>/U',$file_contents,$matches ) ;
$nowPrice = ereg_replace("," , "", $matches[1][0]);
preg_match_all('/<em class="down">(.*)<\/em>/U',$file_contents,$matches ) ;
$chPrice = ereg_replace("," , "", $matches[1][0]);
$chPer = ereg_replace("," , "", $matches[1][1]);
$flag = "DOWN";
} else {
preg_match_all('/<em class="up">(.*)<\/em>/U',$file_contents,$matches ) ;
$chPrice = ereg_replace("," , "", $matches[1][0]);
$chPer = ereg_replace("," , "", $matches[1][1]);
}
$nowTime = explode(" ", $nowTime);
$retStr = $flag."|".$nowName."|".$nowTime[0]."|".$nowTime[1]."|".$nowPrice."|".$chPrice."|".$chPer;
echo iconv("EUC-KR","UTF-8",$retStr);
?>
get.php 등으로 저장하신후
get.php?jcode=종목코드 하시면 몇개정보 가져옵니다.
<?
//extract($_POST);
if( isset($_REQUEST["jcode"]) )
$jcode = $_REQUEST["jcode"];
else
$jcode = "";
$jcode = ( $jcode == "" ) ? "005930":$jcode;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://hyper.moneta.co.kr/fcgi-bin/DelayedCurrPrice7.fcgi?code='.$jcode.'&isReal=true');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$file_contents = curl_exec($ch);
$flag = "UP";
preg_match_all('/<h2>(.*)<\/h2>/U',$file_contents,$matches ) ;
$nowName = strip_tags($matches[1][0]);
preg_match_all('/<p>(.*)<\/p>/U',$file_contents,$matches ) ;
$nowTime = $matches[1][0];
preg_match_all('/<strong class="up">(.*)<\/strong>/U',$file_contents,$matches ) ;
if( isset($matches[1][0]) )
$nowPrice = ereg_replace("," , "", $matches[1][0]);
else
$nowPrice = "";
if( $nowPrice == "" ) {
preg_match_all('/<strong class="down">(.*)<\/strong>/U',$file_contents,$matches ) ;
$nowPrice = ereg_replace("," , "", $matches[1][0]);
preg_match_all('/<em class="down">(.*)<\/em>/U',$file_contents,$matches ) ;
$chPrice = ereg_replace("," , "", $matches[1][0]);
$chPer = ereg_replace("," , "", $matches[1][1]);
$flag = "DOWN";
} else {
preg_match_all('/<em class="up">(.*)<\/em>/U',$file_contents,$matches ) ;
$chPrice = ereg_replace("," , "", $matches[1][0]);
$chPer = ereg_replace("," , "", $matches[1][1]);
}
$nowTime = explode(" ", $nowTime);
$retStr = $flag."|".$nowName."|".$nowTime[0]."|".$nowTime[1]."|".$nowPrice."|".$chPrice."|".$chPer;
echo iconv("EUC-KR","UTF-8",$retStr);
?>

감사합니다. 큰 도움이 될거 같습니다. 이런글은 바로 스크랩 해야 하는데 본인글은 스크랩이 안된다고 하네요 ㅠㅠ 블로그로 옮겨야 겠습니다.감사합니다.

한가지 궁금한게 http://hyper.moneta.co.kr 여긴 어딘가요? 차후에 URL 닫히는 순간 데이터 가져 오지 못하지 않을까 싶어서 말입니다..

팍X넷 에서 사용하는 주소입니다.. 다른 데이터를 스크래핑할때는 그정도는 감수가 되어야죠..
닫히면.. 다른사이트를 뚫는수밖에요;; ^^
닫히면.. 다른사이트를 뚫는수밖에요;; ^^

많은 도움 되었습니다. 감사합니다

어쩔수 없이 php 파싱이 답인걸까요 ㅋ_ㅋ