Home  >  Article  >  php教程  >  php获取淘宝分类id示例

php获取淘宝分类id示例

WBOY
WBOYOriginal
2016-06-06 20:25:341552browse

这篇文章主要介绍了使用php获取淘宝分类id的方法,大家参考使用吧

复制代码 代码如下:


$url = "http://list.taobao.com/browse/cat-0.htm";
  $html = file_get_contents($url);
  echo '';
  $pattern='/\(.*?)\/';
  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 "
";
  }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn