Forum Moderators: coopster
For example, if you wanted to find text contained in the H1 tags you could use this code:
<?
$data = file_get_contents($uri);
if(eregi("<h1>[A-Za-z0-9.][A-Za-z0-9.]*</h1>",$data,$regs)){
echo $regs[0];
}
?>
I don't use preg_match but it may be more/less useful.
Any thoughts from anyone else?
Chris
Dumping/reading whole file, I guess, requires more time, than reading only top/part of it: if a method exits?
I didn't asked anything about preg_match
- - - - -
Every second of time, every bit of memory, every character/space of code is significant in the world of machines..
You haven't told us the criteria yet. When you say top what does that mean? headers? before the body tag? the title only?
anything like file_get_contents reads the whole thing in as a string. If you want to open the connection and only read a portion then you should go with sockets.
These tools analyse more than few Web sites in a click and so go slow.
You can note, I mean to read only top of Web pages e.g., Results 1-10 of toal 23,1845.
You said sockets. Are sockets fast?
One user submitted comment on PHP online documentation on sockets say it's slow.
Can you please kindly show me an example of getting some limited data using sockets (I'm afraid of new term 'sockets'!).
Thanks.