0

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;


?>
2
Contributors
1
Reply
6
Views
5 Years
Discussion Span
Last Post by LastMitch
0

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

Edited by LastMitch: grammer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.