$url = "http://list.taobao.com/browse/cat-0.htm";
$html = file_get_contents($url);
echo '<meta charset="UTF-8">';
$pattern='/\<a\s+href\=\"http\:\/\/list\.taobao\.com\/itemlist\/.*?\&cat\=([0-9]+)\"\s+target\=\"\_blank\"\>(.*?)\<\/a\>/';
preg_match_all($pattern, $html, $array, PREG_SET_ORDER);
foreach($array as $item) {
echo $item[1] . "=>" . mb_convert_encoding($item[2], 'UTF-8', 'GB2312');
echo "<br />";
}
php获取淘宝分类id示例
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/10a3cdfa676b3b8345b676477f6b257f.html