php获取淘宝分类id示例_PHP

WBOY
Release: 2016-06-01 11:57:30
Original
949 people have browsed it

复制代码 代码如下:
$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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!