เอาโค้ดนี้ไปใช้ดู ช่วยๆกันครับ
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
$getpage = get_content("
http://news.mthai.com/general-news/210228.html 
");
preg_match("/<div class=\"entry-title\">([^`]*?)<\/div>/", $getpage, $topic); //
echo $topic[1];
function get_content($URL) {
$ch = curl_init();
$timeout = 0; // set to zero for no timeout
$useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt ($ch, CURLOPT_URL, $URL);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$String = curl_exec($ch);
curl_close($ch);
return $String;
}
?>