PHP正则表达式提取淘宝搜索图片及链接地址

作者:简简单单 2013-07-10

程序代码

 代码如下 复制代码


$keywords=$_GET['word'];//关键词

$p=($_GET['p']-1)*40;//页码

$html = file_get_contents("http://s.taobao.com/search?q=".$keywords."&pid=mm_17149866_0_0&s=".$p."#J_relative");//pid可以自己修改

preg_match_all ("||U",$html,$img_array);//提取图片

preg_match_all('/

/is',$html,$match);//提取超链接

$c=count($match[1]);

for($i=0;$i<$c;$i++)

{

  echo '';

}

?>

相关文章

精彩推荐