$base_regex = '/<base[^>]*' . 'href=[\\"|\'](.*)[\\"|\']/Ui'; preg_match_all($base_regex, $string, $base_match, PREG_PATTERN_ORDER); if (strlen($base_match[1][0]) > 0) { $base_url = $base_match[1][0]; $base_override = true; } // Parse Description $return_array['description'] = ''; $nodes = Request::extract_tags($string, 'meta'); foreach ($nodes as $node) { if (strtolower($node['attributes']['name']) == 'description') { $return_array['description'] = trim($node['attributes']['content']); } } // Parse Images $images_array = Request::extract_tags($string, 'img'); $images = array(); for ($i = 0; $i <= sizeof($images_array); $i++) { $img = trim(@$images_array[$i]['attributes']['src']); $width = preg_replace("/[^0-9.]/", '', $images_array[$i]['attributes']['width']); $height = preg_replace("/[^0-9.]/", '', $images_array[$i]['attributes']['height']); $ext = trim(pathinfo($img, PATHINFO_EXTENSION)); if ($img && $ext != 'gif') { if (substr($img, 0, 7) == 'http://') { } else { if (substr($img, 0, 1) == '/' || $base_override) { $img = $base_url . $img; } else { $img = $relative_url . $img; } }