[Solved] Turning a content into a $variable in php


You can use \DOMDocument->loadHTML();

Ex:

<?php
$doc = new \DomDocument();
$doc->loadHTML('<div class="whatever"> Title </div>');

View examples here:
http://docs.php.net/manual/en/domdocument.loadhtml.php

This is assuming that your source is available to php. It would probably be more pragmatic to extract the value with javascript in the client and send it with the page request. If your app is well structured, the logic that renders the title into the page in the first place is probably where you should be looking to retrieve the information rather than trying to parse the html separately.

solved Turning a

content into a $variable in php