網址是 http://www.taodake.com
獲取遠程post查詢後,抓取查詢的數據。求教代碼,幫幫忙400C幣酬謝了;
已經有人找到接口了,只能是普通的旺旺號,換成商城旺旺或C店旺旺就查詢不到了,估計是另一個接口,請求大家幫找一下另一個接口;
http://wwwsoso002.taodake.com/taobao_data.php?callback=jQuery17105857618552680781_1422435501967&nick=epni59&chkid=0&click=373635346667686A63786365&_=1422435566660
查詢旺旺:top百分百 愛麗缇旗艦店
上面的接口就查不到數據了,如下圖
function escape($string, $in_encoding = 'UTF-8',$out_encoding = 'UCS-2') {
$return = '';
if (function_exists('mb_get_info')) {
for($x = 0; $x < mb_strlen ( $string, $in_encoding ); $x ++) {
$str = mb_substr ( $string, $x, 1, $in_encoding );
if (strlen ( $str ) > 1) { // 多字節字符
$return .= '%u' . strtoupper ( bin2hex ( mb_convert_encoding ( $str, $out_encoding, $in_encoding ) ) );
} else {
$return .=$str;// '%' . strtoupper ( bin2hex ( $str ) );
}
}
}
return $return;
}
$nick=escape('top百分百');
$taobaourl='http://wwwsoso002.taodake.com/taobao_data.php?callback=&nick=' .$nick .'&chkid=0&click=373635346667686A63786365&_=1422435566660';
$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, 'http://www.taodake.com/');
curl_setopt($ch, CURLOPT_COOKIE, 'Hm_lvt_ebeb4888fc38c5c3a030f255b55395e3=1422448628; Hm_lpvt_ebeb4888fc38c5c3a030f255b55395e3=1422448800');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36');
curl_setopt($ch, CURLOPT_URL, $taobaourl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
$content=trim($content,'()');//去除首尾的括號,回調函數沒傳,所以不用理會了
$data = json_decode($content, true);
echo $data['b'];
這個是php版本的。。