News from Entertainment Tonight
250) { $ratio = 250/$width; $width = 250; $height = $height * $ratio; } } elseif ($tag == "MEDIA-REFERENCE") { if ($attrs["CLASS"] == "slate") { $pic = $attrs[SOURCE]; $size = getimagesize($pic); $width = $size[0]; $height = $size[1]; if ($width > 250) { $ratio = 250/$width; $width = 250; $height = $height * $ratio; } } if ($attrs["CLASS"] == "popup-link") { $popupurl = $attrs[SOURCE]; } } } elseif ($name == "ITEM") { $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $title, $description, $link, $pic, $width, $height, $popupurl; if ($name == "ITEM") { printf("
%s
\n", trim($link),htmlspecialchars(trim($title))); if (strlen($popupurl) == 0) { printf("
%s
\n
",trim($description)); } else { printf("
%s
\n
",trim($description)); } $title = ""; $description = ""; $link = ""; $insideitem = false; $pic = ""; $width = ""; $height = ""; $popupurl = ""; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { switch ($tag) { case "TITLE": $title .= $data; break; case "DESCRIPTION": $description .= $data; break; case "LINK": $link .= $data; break; } } } $xml_feed_url = "http://www.etonline.com/partners/rss/index.xml"; $xml = @implode("",file($xml_feed_url)); $xml_parser = xml_parser_create(); xml_parser_set_option( $xml_parser, XML_OPTION_SKIP_WHITE, 1 ); xml_parser_set_option( $xml_parser, XML_OPTION_CASE_FOLDING, 1 ); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); xml_parse($xml_parser, $xml, TRUE) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); xml_parser_free($xml_parser); ?>