Jump to content

Find way to Rip text from website


scottstown

Recommended Posts

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);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.