FatalErrorException в строке HtmlServiceProvider.php 36: laravel

Используйте PHP DomDocument для разбора страницы

$doc = new DOMDocument();

// load the string into the DOM (this is your page's HTML), see below for more info
$doc->loadHTML('Google');

//Loop through each  tag in the dom and change the href property
foreach($doc->getElementsByTagName('a') as $anchor) {
    $link = $anchor->getAttribute('href');
    $link = 'http://www.example.com/?loadpage='.urlencode($link);
    $anchor->setAttribute('href', $link);
}
echo $doc->saveHTML();

Проверьте здесь: http://codepad.org/9enqx3Rv

Если у вас нет HTML в виде строки, вы можете использовать cUrl ( docs ), чтобы захватить HTML, или вы можете использовать метод loadHTMLFile для DomDocument

Документация

13
задан Marcin Nabiałek 22 December 2015 в 11:31
поделиться