$html = preg_replace("'<script[^>]*?>.*?</script>'si","", $result);
$dom = new DOMDocument();
$dom->loadHTML($html);
var_dump($dom);
object(DOMDocument)#3 (34) {
["doctype"]=>
string(22) "(object value omitted)"
["implementation"]=>
string(22) "(object value omitted)"
["documentElement"]=>
string(22) "(object value omitted)"
["actualEncoding"]=>
string(5) "utf-8"
["encoding"]=>
string(5) "utf-8"
["xmlEncoding"]=>
string(5) "utf-8"
["standalone"]=>
bool(true)
["xmlStandalone"]=>
bool(true)
["version"]=>
NULL
["xmlVersion"]=>
NULL
["strictErrorChecking"]=>
bool(true)
["documentURI"]=>
NULL
["config"]=>
NULL
["formatOutput"]=>
bool(false)
["validateOnParse"]=>
bool(false)
["resolveExternals"]=>
bool(false)
["preserveWhiteSpace"]=>
bool(true)
["recover"]=>
bool(false)
["substituteEntities"]=>
bool(false)
["nodeName"]=>
string(9) "#document"
["nodeValue"]=>
NULL
["nodeType"]=>
int(13)
["parentNode"]=>
NULL
["childNodes"]=>
string(22) "(object value omitted)"
["firstChild"]=>
string(22) "(object value omitted)"
["lastChild"]=>
string(22) "(object value omitted)"
["previousSibling"]=>
NULL
["attributes"]=>
NULL
["ownerDocument"]=>
NULL
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
NULL
["textContent"]=>
string(984) "Sign In
@media only screen and (min-device-width: 481px) {
.wrapper {
margin-bottom: -66px;
padding-bottom: 66px;
}
}
@media only screen and (max-device-width: 480px) {
.wrapper {
margin-bottom: -122px;
padding-bottom: 122px;
}
}
Privacy Policy
Terms of Use
"
}
<div>
какой то текст
</div>
<script>Код JS</script>
<div>
какой то текст
</div>
<div>
какой то текст
</div>
<div>
какой то текст
</div>
<script>Код JS</script>
$dom = new DOMDocument();
$dom->loadHTML($result, LIBXML_NOWARNING | LIBXML_NOERROR);
var_dump($dom);
if (!$doc->load('file.xml')) {
foreach (libxml_get_errors() as $error) {
// обработка ошибок здесь
}
libxml_clear_errors();
}
$dom = new DOMDocument();
$dom->loadHTML($html);
$xpath = new DOMXpath($dom);
foreach($xpath->query('//iframe') as $iframe) {
echo $iframe->getAttribute('src');
}
$dom->loadHTML($html);
class Script {
private $DB;
public function __construct($DB_SERVER, $DB_USER, $DB_PASS, $DB_BASE)
{
$this->DB = new mysqli($DB_SERVER, $DB_USER, $DB_PASS, $DB_BASE);
}
function FunctionName ()
{
//....
}
}
$object = new Script($DB_SERVER, $DB_USER, $DB_PASS, $DB_BASE);
$request = $object->FunctionName();
$this->DB_DO->query(тут вставлять готовую переменную которую сформировал выше);