1

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 url, but how to add second source and make it work with "echo" function?

Thanks

Mark Longair
  • 446,582
  • 72
  • 411
  • 327
Henry
  • 11
  • 4

1 Answers1

0

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);
AJJ
  • 7,365
  • 7
  • 31
  • 34