nimedon Posted June 7, 2007 Share Posted June 7, 2007 Hi, is there anyway to copy a part of another webpage to show in my page, for example copy the statics of the following webpage: http://otservlist.org/ and the statics are here: <td> <fieldset><legend> Servers statistics </legend> We have <strong>6743</strong> servers in our database<br /> Current Time: June 7, 2007, 6:01 am </fieldset> </td> but I want to refresh them, how can I do this? thanks in advance, Nimedon Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/ Share on other sites More sharing options...
trq Posted June 7, 2007 Share Posted June 7, 2007 Take a look at file_get_contents(). Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-269752 Share on other sites More sharing options...
Psycho Posted June 7, 2007 Share Posted June 7, 2007 @nimedon And while you're at it - also take a look at the copyright at the bottom of the page you linked to. They don't put it there "for fun" you know. An honorable person would at least ask permission and include a "Provided By" message on the page with a link back to the source. Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-269786 Share on other sites More sharing options...
nimedon Posted June 7, 2007 Author Share Posted June 7, 2007 @mjdamato: I will, I hate persons that quit credits Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270084 Share on other sites More sharing options...
nimedon Posted June 7, 2007 Author Share Posted June 7, 2007 I taked a look at that function, but I can't get it work, can anyone give me an example or somthing? Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270090 Share on other sites More sharing options...
chigley Posted June 7, 2007 Share Posted June 7, 2007 <?php $pagesource = file_get_contents("http://www.otservlist.org"); echo $pagesource; ?> Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270094 Share on other sites More sharing options...
nimedon Posted June 7, 2007 Author Share Posted June 7, 2007 but, it prints the whole page, how can I do to just print a part? Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270098 Share on other sites More sharing options...
chigley Posted June 7, 2007 Share Posted June 7, 2007 Depends which part of it you want! You need to parse the data you have Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270099 Share on other sites More sharing options...
nimedon Posted June 7, 2007 Author Share Posted June 7, 2007 I want to print the part of Server Statics, how do I parse the data? Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270101 Share on other sites More sharing options...
chigley Posted June 7, 2007 Share Posted June 7, 2007 <?php function textbetweenarray($s1,$s2,$s){ $myarray=array(); $s1=strtolower($s1); $s2=strtolower($s2); $L1=strlen($s1); $L2=strlen($s2); $scheck=strtolower($s); do{ $pos1 = strpos($scheck,$s1); if($pos1!==false){ $pos2 = strpos(substr($scheck,$pos1+$L1),$s2); if($pos2!==false){ $myarray[]=substr($s,$pos1+$L1,$pos2); $s=substr($s,$pos1+$L1+$pos2+$L2); $scheck=strtolower($s); } } } while (($pos1!==false)and($pos2!==false)); return $myarray; } $pagesource = file_get_contents("http://www.otservlist.org"); $fieldsets = textbetweenarray("<fieldset>", "</fieldset>", $pagesource); $serverstats = $fieldsets[1]; echo $serverstats; ?> Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270103 Share on other sites More sharing options...
nimedon Posted June 7, 2007 Author Share Posted June 7, 2007 o.0 I love you!!! ty very much!! :* Link to comment https://forums.phpfreaks.com/topic/54532-its-posible-to-copy-a-part-of-a-web-page-to-show-on-mine/#findComment-270104 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.