从不同站点获取数据的最简单方法

时间:2011-07-25 12:56:39

标签: php web-scraping

我想从不同网站获取静态数据(提供的网址和元素名称),最简单的方法是什么?

www.address /物品/抓斗此

<html>
   (...)
   <article id="#article-121">
     <h1>Header</h1>
     <p>Contents</p>
    </article>
   (...)
</html>

的index.php

/* Grab "#article-121" from www.address/articles/grab-this */

   <article id="#article-121">
         <h1>Header</h1>
         <p>Contents</p>
   </article>

/* Close the connection */

1 个答案:

答案 0 :(得分:2)

$contents = file_get_contents(url_goes_here);