ต้นทางเค้าจับได้ว่าเราใช้ cURL
ใจเยนๆ พลายามหาให้เจอ
ไม่พูดมาก วันนี้วันดี แจก เลย
เชคก่อนเว็บ ok มั้ย เอาโค้ด 200
function check_url($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch , CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$headers = curl_getinfo($ch);
curl_close($ch);
return $headers['http_code'];
}
แล้วค่อย ดูด
function file_get_contents_curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$chanelCH = rand(1,2);
switch ($chanelCH) {
case 1:
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; **************************');
break;
case 2:
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows *******************************************');
break;
}
$cookiefile = 'tmp/cookie.txt';
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
//$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
return $data;
}
ตย. คือ
จาก
ปรับเป็น