ok so can some one help me with a code i know how to use file_get_contents() but i need help to display only a particular data from the url i want to get the data from say something like this <div id=test>30</div> Code (markup): i want to pull the 30 out of the url only and not the other data
You can use preg_match, or you can use my own function below. // Usage $data = file_get_contents('...'); $string = between('<div id=test>', '</div>', $data); function between($start, $end, $source) { $s = strpos($source, $start) + strlen($start); return substr($source, $s, strpos($source, $end, $s) - $s); } PHP: