|
|
@ -192,6 +192,16 @@ class Parse { |
|
|
|
|
|
|
|
$xpath = new DOMXPath($doc); |
|
|
|
|
|
|
|
// Check for meta http equiv and replace the status code if present
|
|
|
|
foreach($xpath->query('//meta[@http-equiv=\'status\']') as $el) { |
|
|
|
$equivStatus = ''.$el->getAttribute('content'); |
|
|
|
if($equivStatus && is_string($equivStatus)) { |
|
|
|
if(preg_match('/^(\d+)/', $equivStatus, $match)) { |
|
|
|
$result['code'] = (int)$match[1]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// If a target parameter was provided, make sure a link to it exists on the page
|
|
|
|
if($target=$request->get('target')) { |
|
|
|
$found = []; |
|
|
@ -228,16 +238,6 @@ class Parse { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Check for meta http equiv and replace the status code if present
|
|
|
|
foreach($xpath->query('//meta[@http-equiv=\'status\']') as $el) { |
|
|
|
$equivStatus = ''.$el->getAttribute('content'); |
|
|
|
if($equivStatus && is_string($equivStatus)) { |
|
|
|
if(preg_match('/^(\d+)/', $equivStatus, $match)) { |
|
|
|
$result['code'] = (int)$match[1]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// If the URL has a fragment ID, find the DOM starting at that node and parse it instead
|
|
|
|
$html = $result['body']; |
|
|
|
|
|
|
|