libxml_use_internal_errors (true); $url = "https://twitter.com/stl_hunt"; $html = file_get_contents($url); $DOM = new DOMDocument(); $DOM->loadHTML($html); $finder = new DomXPath($DOM); $classname = 'tweet-text'; $nodes = $finder->query("//*[contains(@class, '$classname')]"); foreach ($nodes as $node) { echo "<div style='margin-bottom: 50px;'>".$node->nodeValue."</div>";