我希望‘窃取’一个网站的div,并将其嵌入到我的网站上(不使用iframe)。谁能告诉我确切的方法是什么?谢谢。
发布于 2011-04-23 10:13:01
非常简单:
您可以使用file_get_contents()或http://simplehtmldom.sourceforge.net/manual.htm来获取所有超文本标记语言的页面,然后使用javascript或Jquery获取DIV。
下面是一个例子:
$homepage = file_get_contents('http://www.somesite.com/');然后您就可以解析$homepage变量了。
或
我会做的是:
http://simplehtmldom.sourceforge.net/manual.htm
$html = file_get_html('http://www.google.com/');
$ret = $html->find('div[id=foo]'); https://stackoverflow.com/questions/5761658
复制相似问题