scottstown Posted March 27, 2008 Share Posted March 27, 2008 Hey, im trying to find a way to "rip" the text from a website. Basically im trying to be able to see a site with no images, ads, etc.. I was thinking of maybe trying curl. Does anyone have any ideas of how to do this? Thanks Scott Link to comment https://forums.phpfreaks.com/topic/98104-find-way-to-rip-text-from-website/ Share on other sites More sharing options...
The Little Guy Posted March 27, 2008 Share Posted March 27, 2008 do you want just the text or the HTML too? Link to comment https://forums.phpfreaks.com/topic/98104-find-way-to-rip-text-from-website/#findComment-501910 Share on other sites More sharing options...
scottstown Posted March 27, 2008 Author Share Posted March 27, 2008 just the text Link to comment https://forums.phpfreaks.com/topic/98104-find-way-to-rip-text-from-website/#findComment-501911 Share on other sites More sharing options...
scottstown Posted March 28, 2008 Author Share Posted March 28, 2008 does anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/98104-find-way-to-rip-text-from-website/#findComment-502690 Share on other sites More sharing options...
The Little Guy Posted March 28, 2008 Share Posted March 28, 2008 cURL is one way, another would be to fopen: (untested) <?php // get contents of a file into a string $filename = "http://google.com"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); $find = array("~<script(.*)</script>~","~<style(.*)</style>~"); $repl= array(" "," "); $contents = preg_replace($find,$repl,$contents); $contents = strip_tags($contents); echo $contents; fclose($handle); ?> Link to comment https://forums.phpfreaks.com/topic/98104-find-way-to-rip-text-from-website/#findComment-502749 Share on other sites More sharing options...
inactive Posted March 28, 2008 Share Posted March 28, 2008 heard of snoopy? it has a text only setting i'm pretty sure. have a look around sourceforge for it. Link to comment https://forums.phpfreaks.com/topic/98104-find-way-to-rip-text-from-website/#findComment-502835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.