一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

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 '';

}

?>

热门栏目