Hello,

I am having trouble fetching content from a web-page,
actually i wanted to fetch all the inner text from div name 'displaybody'

but my code doesn't seems working, it is fetching all the content of the page
and after 4 page successfully fetched i get an error,

[B]Fatal error: Maximum execution time of 30 seconds exceeded in E:\Installations\xampp\htdocs\wp\simple_html_dom.php on line 127[/B]

Here is the code for the script,

I want my script to open all the sub-pages(/txt/any number) inside the url mentioned in the code and fetched the content from its particular div (displaybody)

<?php
include ('simple_html_dom.php');
	$request_url ='http://www.zedge.net/txts/4519/200-3-1/';
 
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $request_url);	
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$result = curl_exec($ch);
 
	$regex='/href=\"\/txt\/[0-9].*/';
	preg_match_all($regex,$result,$parts);
	
	foreach($parts[0] as $link){
		$url = 'http://zedge.net' . str_replace ("href=\"",'',$link);
        echo file_get_html($url)->plaintext; 
		echo "<br /><br /	><br />";
	}
	
	curl_close($ch);

echo $html->find('displaybody', 0)->innertext;


?>
Member Avatar for LastMitch

but my code doesn't seems working, it is fetching all the content of the page
and after 4 page successfully fetched i get an error,

[B]Fatal error: Maximum execution time of 30 seconds exceeded in E:\Installations\xampp\htdocs\wp\simple_html_dom.php on line 127[/B]

Here is the code for the script,

I think someone has an anwser/solution for the issue you are having here:

http://stackoverflow.com/questions/9556198/fetching-inner-text-from-a-particular-div

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.