Content summary of ""...
(.+?)
%is";
$urlparts = parse_url($url);
if ($urlparts[path] == "") $url .= "/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 8);
$data = curl_exec($ch)
or die("Error reading RSS data.");
curl_close($ch);
$match_count = preg_match_all($itemregexp, $data, $items);
$match_count = ($match_count > 50) ? 50 : $match_count;
for ($i=0; $i< $match_count; $i++) {
$body = $items[1][$i];
if (preg_match ("/rssi1/i", $body)) {
preg_match ("%rssi1 *\" *>(.+?)%is", $body, $subj);
$title = $subj[1];
} else {
$title = substr(trim(strip_tags($body)),0,50) . " ...";
}
$item_url = get_link($body, $url);
if (preg_match ("/rssi1/i", $body)) {
$desc = stristr($body, "");
$desc = substr(trim(strip_tags($desc)),0,120);
} else {
$desc = substr(trim(strip_tags($body)),0,120);
}
$desc = substr($desc, 0, strrpos($desc, " ")) . " ...";
$desc = htmlentities($desc);
$output .= "\n";
$output .= "". $desc ."
\n";
}
print $output;
}
function get_link($body, $url) {
if (stristr($body, "rssi2\" href")) {
$linkurl = stristr($body, "rssi2\" href");
$linkurl = substr($linkurl, strpos($linkurl, "\"")+1);
$linkurl = substr($linkurl, strpos($linkurl, "\"")+1);
$linkurl = substr($linkurl, 0, strpos($linkurl, "\""));
$linkurl = trim($linkurl);
return $linkurl;
} else {
return $url;
}
}
parse_html($url);
?>