Posts Tagged ‘HTML from outer source’

[HOW TO]: Fetch a certain part of HTML, Text or PHP From Outer Source With PHP

I am going to teach you how to fetch certain part of HTML, Text or PHP for any outer source(i.e. From a website). Please read all the contents clearly. You most have a problem to fetching a certain part of HTML or PHP because Text files are more easy to handle. We here do not fetch the PHP code but we fetch the HTML code after the code is published in a website. Those code are HTML codes most and your can easily view in the source. But the main problem with the user are they cannot fetch the code although all the code is found to be correct. The code that I use is given below:

<?php
$contents = file_get_contents(‘http://www.example.com’);
$term_search=”The term to be searched”;
$no_term=1000;
$pos=strpos($contents, $term_search);
$pos += strlen($term_search);
$new_pos = substr($contents,$pos,$no_term);
echo $new_pos;
?>

Read the rest of this entry »