 |
|
รบกวนสอบถาม พี่ ๆ ช่วยดูโค้ดให้หน่อยนะคะ ต้องการดึงข้อมูลจากเว็บแล้วตัดหัวข้อออก กำหนดให้ดึงเฉพาะข้อมูลที่เราต้องการ คือตอนนี้สามารถดึงข้อมูลได้แล้วคะ แต่มันมีหัวข้อด้วยอยากให้มันตัดเหลือแต่เนื้อหาอ่ะคะ รบกวนด้วยนะคะ ขอบคุณคะ
Code (PHP)
include('C:\AppServ\simple_html_dom.php');
$urlWithoutProtocol = "http://www.su.ac.th/html_news/news_template.asp?id=5660";
$request = "";
$isRequestHeader = false;
$exHeaderInfoArr = array();
$exHeaderInfoArr[] = "Content-type: text/xml";
$exHeaderInfoArr[] = "Authorization: "."Basic ".base64_encode("authen_user:authen_pwd");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlWithoutProtocol);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HEADER, (($isRequestHeader) ? 1 : 0));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if( is_array($exHeaderInfo) && !empty($exHeaderInfo) )
{
curl_setopt($ch, CURLOPT_HTTPHEADER, $exHeaderInfo);
}
$response = curl_exec($ch);
curl_close($ch);
$html = str_get_html($response);
$elem = $html->find('table td.ms09', 0)->plaintext;
echo $elem;
Tag : PHP
|
|
 |
 |
 |
 |
Date :
2012-05-23 22:25:41 |
By :
Butterney |
View :
2772 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |