ใช้ curl ดึงหน้าเพจนึง แต่เอาขึ้น host แล้วแสดงผลคนละแบบ

เริ่มโดย tae861, 06 มีนาคม 2016, 15:12:59

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

tae861

function web($url){
$header = array('Referer: http://www.xxx.com/d-xxx-1.html');

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)');

$retValue = curl_exec($ch);
$response = json_decode(curl_exec($ch));
return $retValue;
}


คือลองรันแล้วหน้าเว็บจะให้รหัสมา แต่ host รับค่าต่างจาก localhost ที่จำลองในเครื่อง  :wanwan001:
ใครพอจะมีไอเดียมั้ยครับ

~บอล~