 |
|
รบกวนพี่ ๆ ช่วยดูโค้ดนี้ให้หน่อยนะคะ เป็นโค้ดที่ดึงข้อมูลมาจากเว็บคะ ปัญหาคือ output ที่ออกมาไม่เป็นภาษาไทยคะ ต้องแก้ไขยังไงคะ ขอบคุณคะ
Code (PHP)
include('C:\AppServ\simple_html_dom.php');
$urlWithoutProtocol = "http://www.su.ac.th/html_news/news_template.asp?id=5785";
$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;
$textfile= "test.txt";
$filew= fopen($textfile, 'w');
fwrite($filew, $elem);
fclose($filew);
echo $elem;
Tag : PHP
|
|
 |
 |
 |
 |
Date :
2012-05-20 13:07:09 |
By :
Butterney |
View :
1192 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |