Simple HTML dom parser for multiple URLs
I'm parsing fine from one url, but how do i add a second source url in the same file.
e.g.
$html = file_get_html('http://google.com');
for one 开发者_C百科url, but how to add second source and make it work with "echo" function?
Thanks
I don't think most parsers will let you add invalid duplicated tags like <head>
and <body>
. You could try by first parsing both URLs and extracting their bodies:
$page1 = file_get_html('url1');
$body1 = $page1->find('body');
$page2 = file_get_html('url2');
$body2 = $page2->find('body');
Then get them together and parse back:
$body1 = $body1->plaintext;
$body2 = $body2->plaintext;
$bodies = str_get_html($body1.$body2);
精彩评论