Catch data from HTML page

sizzla

New Member
Messages
94
Reaction score
0
Points
0
hey,
can anyone help me with this:
I want some dynamic text from a html file (it changes every 3 minites) to save in a variable. I had a way to do this:


Code:
<?php

$url = "http://example.com/dyncontent.html"; 

//open this file to read
$fp = fopen($url, "r"); 
$search = fread($fp, 50000); 
fclose($fp); 

//search for the tags which surround the figure
$search = ereg('some text before the wanted content>(.*)and here behind', $search,$content); 


echo 'dyncontent=' . $content[1];

?>

But this ain't working good, when i refresh my php page, my echoed var changes every time, so its not a good way!

someone can help me please? :sad:
 

The_Magistrate

New Member
Messages
1,118
Reaction score
0
Points
0
I'm not quite understanding what you're trying to do.

What I think you're asking is you want to record dynamic content from another website and store a history on your own. If this is true, you'll have to keep a record of the information in a text file, database, or cookie to keep it preserved across page refreshes. The best way to do this is to pull the information into $search, then append the contents to a text file on your server.
 

sizzla

New Member
Messages
94
Reaction score
0
Points
0
thanx for your reply The_Magistrate!
only i don't want to record it, i just want to show it on my page!

http://example.com/page.html:
Code:
<html>
....
we have now 2512 visitors
...
</html>

so i have my page me.com and i want to catch the number of visitors of the previous site (example.com), and you know the content will change (visitors) constantly. so just with refrsh, it'll re-read the number of visitors.
so i only want that number be echoed in php

i hope its clear now! :happy:
 
Top