Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用于多个URL的简单HTML dom解析器_Php_Html_Dom - Fatal编程技术网

Php 用于多个URL的简单HTML dom解析器

Php 用于多个URL的简单HTML dom解析器,php,html,dom,Php,Html,Dom,我可以从一个url解析,但是如何在同一个文件中添加第二个源url呢 e、 g 对于一个url,如何添加第二个源并使其与“echo”功能一起工作 谢谢我认为大多数解析器不会允许您添加无效的重复标记,如和。您可以先解析两个URL并提取其正文: $page1 = file_get_html('url1'); $body1 = $page1->find('body'); $page2 = file_get_html('url2'); $body2 = $page2->find('body'

我可以从一个url解析,但是如何在同一个文件中添加第二个源url呢

e、 g

对于一个url,如何添加第二个源并使其与“echo”功能一起工作


谢谢

我认为大多数解析器不会允许您添加无效的重复标记,如
。您可以先解析两个URL并提取其正文:

$page1 = file_get_html('url1');
$body1 = $page1->find('body');

$page2 = file_get_html('url2');
$body2 = $page2->find('body');
然后将它们放在一起并进行分析:

$body1 = $body1->plaintext;
$body2 = $body2->plaintext;
$bodies = str_get_html($body1.$body2);
“使其与“回声”功能一起工作”应该是什么意思?(相关)
$body1 = $body1->plaintext;
$body2 = $body2->plaintext;
$bodies = str_get_html($body1.$body2);