Page 1 of 1

file_get_html and dom -- stuck in problem -- help needed

Posted: Sun May 17, 2015 2:02 am
by qam47
I am trying to fetch the html source code ... let me explain:

1: on the news page of the website there are headlines links.
2: go inside that links and fetch the html of that page.
3: with simple dom only fetch the article image.
4: output all the images.

but i am stuck in the 2nd part.

here is the code:

Code: Select all

<?php
	require('simple_html_dom.php');
	
	$url = 'http://www.goal.com/en/news/archive/1/';
	$site_url = 'http://www.goal.com/';
	
	$html = file_get_html($url);
			
			$links = array();
			
			// List Title Links of on the page...........
			// --------------------------------------------
			foreach($html->find('.imgBox') as $tl) {
				$url_inner  =  $tl->find('a', 0)->href;
				
			
			// Inside of the Title Links
			// --------------------------------------------
			
			$innerpage = file_get_contents($site_url . $url_inner);
			
			$html_innerpage = file_get_html($innerpage);
						
				echo $html_innerpage;
			
			}
			

						
?>

Re: file_get_html and dom -- stuck in problem -- help needed

Posted: Sun May 17, 2015 7:58 am
by Celauran
How are you stuck? What errors are you encountering?