Hi everyone,
I try to find the way to get just a part of a web source page ? I'm using php to get the all source code of the page but i don't need to get the entire page source.
Is someone can help me please ?
Joe
Hi everyone,
I try to find the way to get just a part of a web source page ? I'm using php to get the all source code of the page but i don't need to get the entire page source.
Is someone can help me please ?
Joe
You can use Simple HTML DOM to do that easily.
Example:
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');
// Find all images
foreach($html->find('img') as $element)
echo $element->src . '<br>';
// Find all links
foreach($html->find('a') as $element)
echo $element->href . '<br>';
There is more to it, visit the provided link for more information about it.
Note: If you meant server-side source code (PHP, ASP.Net, etc), it is not possible here.
HTTP has a couple of request headers that deal with ranges, but even if the server supports them, they aren't a very practical way to get part of a larger HTML document.
You would be better off having the server provide an API which gives you just the information you want (this might involve negotiating with whomever runs the site, if that isn't you).