使用php采集电商网站的商品信息
2016-07-29 14:28
399 查看
<?php require ('phpquery/phpQuery/phpQuery.php'); $filePath1=$_POST['pname']; if($filePath1){ $fileContent = file_get_contents($filePath1);//缓存网页 phpquery::newDocumentHTML($fileContent); //初始化,读取html源码 $match = pq('.m-detail-main-title > h1')->html(); $content_list=pq('#introPanel')->html(); $jiage=pq('.m-detail-main-one-price:first-child')->html(); }else{ $match=''; $content_list=''; $filePath1=''; $jiage=''; } ?> <!DOCTYPE HTML> <html> <head> <title>随意一个页面的商品采集系统</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> <div style="width:800px; border:1px solid #ccc; margin:15px auto; padding:10px;"> <form action='caiji.php' method='post'> <p>采集地址:<input type="text" name='pname' style="width:600px;" value='<?php echo $filePath1?>'/></p> <p>商品标题:<input type="text" name='ptitle' style="width:600px;" value='<?php echo $match;?>'/></p> <p>商品价格:<input type="text" name='ptitle' style="width:600px;" value='<?php echo $jiage;?>'/></p> <p><p>商品内容:</p><textarea style="width:600px; margin-left:70px; height:400px;"><?php echo $content_list?></textarea></p> <p><button>一键采集</button></p> </form> </div> </body> </html> <!-- <div class="thumb" id="Thumb-13164-3640" style="position: absolute; left: 0px; top: 0px;"> <a href="/Spiderman-City-Drive"> <img src="/thumb/12/Spiderman-City-Drive.jpg" alt=""> <span class="GameName" id="GameName-13164-3640" style="display: none;">Spiderman City Drive</span> <span class="GameRating" id="GameRating-13164-3640" style="display: none;"> <span style="width: 68.14816px;"></span> </span> </a> </div> <div class="thumb" id="Thumb-13169-5946" style="position: absolute; left: 190px; top: 0px;"> <a href="/Spiderman-City-Raid"> <img src="/thumb/12/Spiderman-City-Raid.jpg" alt=""> <span class="GameName" id="GameName-13169-5946" style="display: none;">Spiderman - City Raid</span> <span class="GameRating" id="GameRating-13169-5946" style="display: none;"> <span style="width: 67.01152px;"></span> </span> </a> </div> -->
这里以采集网易一元云购 为列子随便选择一个商品进行采集会显示价格 图片 名字等
http://1.163.com
相关文章推荐
- 框架、架构摄取
- Milestone 系统架构 及产品白皮书
- 网站文章如何能自动判定是抄袭?一种算法和实践架构剖析
- 一个网站空间绑定多个域名指向不同路径方法
- 网站上简单的渐变色用法
- Windows平台分布式网站系统应用(转)
- 多态的设计
- 大型网站技术架构:核心原理与案例分析—第一章:大型网站架构演化
- 关于大型网站架构的两本经典书籍
- 软件架构为何重要?---不可取代的专业能力系列(三)
- 前端插件下载网站分享
- web 使网站在浏览器中全屏显示 fullscreen=yes
- 恰如其分的软件架构---不可取代的专业能力系列(二)
- 教你如何分辨用户是用手机还是电脑访问你的网站
- 知名IT网站汇总
- x86架构里的cache
- HTML5 练习网站
- 逐步深入三层架构(一)-初识
- 谈谈对于企业级系统架构的理解
- 用Meta标签代码让360双核浏览器默认极速模式打开网站