1 <?php 2 function ip() 3 { 4 $ip_long = array( 5 array('607649792', '608174079'), // 36.56.0.0-36.63.255.255 6 array('1038614528', '1039007743'), // 61.232.0.0-61.237.255.255 7 array('1783627776', '1784676351'), // 106.80.0.0-106.95.255.255 8 array('2035023872', '2035154943'), // 121.76.0.0-121.77.255.255 9 array('2078801920', '2079064063'), // 123.232.0.0-123.235.255.255 10 array('-1950089216', '-1948778497'), // 139.196.0.0-139.215.255.255 11 array('-1425539072', '-1425014785'), // 171.8.0.0-171.15.255.255 12 array('-1236271104', '-1235419137'), // 182.80.0.0-182.92.255.255 13 array('-770113536', '-768606209'), // 210.25.0.0-210.47.255.255 14 array('-569376768', '-564133889'), // 222.16.0.0-222.95.255.255 15 ); 16 $rand_key = mt_rand(0, 9); 17 return $ip = long2ip(mt_rand($ip_long[$rand_key][0], $ip_long[$rand_key][1])); 18 } 19 20 21 function gethtml($urlc,$refer,$qingqiuip){ 22 $ch = curl_init($urlc); 23 //$refer= "http://m.kuwo.com"; 24 $header = array( 25 'CLIENT-IP:'.$qingqiuip, 26 'X-FORWARDED-FOR:'.$qingqiuip, 27 ); 28 curl_setopt($ch,CURLOPT_HTTPHEADER, $header); 29 curl_setopt($ch,CURLOPT_REFERER, $refer); 30 curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); 31 curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)'); 32 curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); 33 curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); 34 curl_setopt($ch,CURLOPT_BINARYTRANSFER, 1); 35 curl_setopt($ch,CURLOPT_TIMEOUT,30); 36 $data=curl_exec($ch); 37 curl_close($ch); 38 return $data; 39 } 40 41 $url=$_GET["url"]; 42 $urlcode = gethtml($url,"http://m.kuwo.cn/",ip()); 43 echo $urlcode;