Stotty Posted May 3, 2009 Share Posted May 3, 2009 Right ive got my website And im trying to add news of another website eg Runescape.com there latest news so on my website in the code i would put <div class=""newsTitle""> But it needs to open runescape first so it knows to get divclass from runescape.com Anyone help ? Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/ Share on other sites More sharing options...
Stotty Posted May 3, 2009 Author Share Posted May 3, 2009 Bump Please help need to get this done quick Thanks in advanced Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-824972 Share on other sites More sharing options...
gevans Posted May 3, 2009 Share Posted May 3, 2009 Bump Please help need to get this done quick Thanks in advanced If you're in a hurry you should consider paying someone to do what you can't. Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-824974 Share on other sites More sharing options...
Stotty Posted May 3, 2009 Author Share Posted May 3, 2009 Sorry Do you know how to do it matey and thanks for your help before Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-824975 Share on other sites More sharing options...
Goldeneye Posted May 3, 2009 Share Posted May 3, 2009 Well there is no easy way to do it. There may be a way to do it (not that I would know), but not as easily as if that site had an RSS Feed. Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-824976 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Go to php.net and search for cURL. Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-824978 Share on other sites More sharing options...
Stotty Posted May 3, 2009 Author Share Posted May 3, 2009 <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?> Thats the code If i wanted to open a div " <div class=""newsTitle""> " from runescape.com how would i do that Cheers In Advanced Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-825022 Share on other sites More sharing options...
gevans Posted May 3, 2009 Share Posted May 3, 2009 Once you've run the curl functions you should have a variable with the page content assigned. You can then use a function (like a regex string replace function) to only get the content you want from the page. I recommend taking that question to the regex past of the forum. If we look at it literally you'll be saying find everything between the open and close div tags with a class of newsTitle. Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-825023 Share on other sites More sharing options...
DarkSuperHero Posted May 3, 2009 Share Posted May 3, 2009 i found this simple PHP DOM parser... looks promising...looks like you could def use this... http://simplehtmldom.sourceforge.net/ Link to comment https://forums.phpfreaks.com/topic/156675-opening-2-websites-easy/#findComment-825122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.