loadHTML($response); $xpath = new DOMXPath($dom); $nodes = $xpath->query($mask); if ($nodes->length > 0) { $firstNode = $nodes->item(0)->textContent; $cleanedContent = ltrim($firstNode); return $cleanedContent; } } }