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

php获取淘宝分类id示例

WBOY
Release: 2016-06-06 20:25:34
Original
1576 people have browsed it

这篇文章主要介绍了使用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 "
";
  }

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template