티스토리 뷰

Study

snoopy(스누피) 관련

메디츠 2024. 1. 21. 13:47
반응형

2020년 4월 기준.

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://finance.naver.com/sise/sise_rise.nhn');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$result = curl_exec($ch);

echo iconv("euc-kr","utf-8", $result);

// https snoopy 안됨. https curl 사용.

 

preg_match('/<h3 id="articleTitle">(.*?)<\/h3>/is', $result, $text);

echo $text[0];

preg_match('/<div id="articleBodyContents" class="_article_body_contents">(.*?)<\/div>/is', $result, $text);

echo $text[0];

 

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함