| 9:56 am on Oct 29, 2005 (gmt 0)|
If you want to read part of the file that is contained within certain tags, text, or other objects in the script that will always be the same, I suggest you use something like eregi or preg_match.
For example, if you wanted to find text contained in the H1 tags you could use this code:
$data = file_get_contents($uri);
(Anyone please correct this if any of it is wrong)
I don't use preg_match but it may be more/less useful.
Any thoughts from anyone else?
| 11:52 am on Oct 29, 2005 (gmt 0)|
What I wanted is speed in my script.
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..
| 2:39 pm on Oct 29, 2005 (gmt 0)|
what chriswragg was sayingh is that you could pull a specific portion.
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.
| 5:28 pm on Oct 29, 2005 (gmt 0)|
I'd made SEO tools for checking links to and from a Web site. It simply rely on results, I get from Google, Yahoo! and MSN.
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'!).
| 8:20 pm on Oct 29, 2005 (gmt 0)|
use curl with --max-filesize <bytes>, this will limit how many bytes you download from a page, but will not just extra the header
| 7:11 am on Oct 31, 2005 (gmt 0)|
How to ensure curl module is enabled. I guess, most hosts won't enable it (shared hosting).
phpinfo() says ctype functions enabled. Is it mean CURL installed. Can you point me an example?