December 3, 2012
In The News
preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($simpleXmlObject->asXML());
return $dom->saveXML();
}
function strip_html_tags( $text )
{
$text = preg_replace(
array(
// Remove invisible content
'@]*?>.*?@siu',
'@@siu',
'@@siu',
'@]*?.*? @siu',
'@]*?.*? @siu',
'@]*?.*? @siu',
'@]*?.*? @siu',
'@]*?.*? @siu',
'@]*?.*? @siu',
// Add line breaks before and after blocks
'@?((address)|(blockquote)|(center)|(del))@iu',
'@?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
'@?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
'@?((table)|(th)|(td)|(caption))@iu',
'@?((form)|(button)|(fieldset)|(legend)|(input))@iu',
'@?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
'@?((frameset)|(frame)|(iframe))@iu',
),
array(
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
"\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0",
"\n\$0", "\n\$0",
),
$text );
return strip_tags( $text );
}
/* gets the data from a URL */
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function socket_get_data() {
$fp = fsockopen("www.hrvendornews.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno) \n";
} else {
$result = "";
$out = "GET /?feed=rss2 HTTP/1.1\r\n";
$out .= "Host: www.hrvendornews.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$result .= fgets($fp, 128);
}
fclose($fp);
}
$result = substr($result, strpos($result, "\r\n\r\n") + 10);
$result = substr($result, 0, strpos($result, "") + 6);
return $result;
}
//$content = file_get_contents("http://www.hrvendornews.com/?feed=rss2");
$content = socket_get_data("http://www.hrvendornews.com/?feed=rss2");
$rss = simplexml_load_string($content);
$mainLink = $rss->channel->link;
foreach ($rss->channel->item as $item)
{
$title = $item->title;
if($title == '')
{
if($item->summary == '')
{
$descr = strip_html_tags($item->description);
}
else
{
$descr = strip_html_tags($item->summary);
}
$title = substr($descr, 0, 45)."...";
}
$url = $item->link;
$pubdate = $item->pubDate;
if($pubdate == '')
{
$pos = strpos($item->description, "-");
$pubdate = substr($item->description, 0, $pos - 1);
if(!strtotime($pubdate))
{
$linke = str_replace($mainLink, "", $url);
$exp = explode("/", $linke);
$pubdate = $exp[1]."-".$exp[2]."-".$exp[3]." 00:00:00";
}
else
$pubdate = date("Y-m-d H:i:s", strtotime($pubdate));
}
$descr = strip_html_tags($item->description);
if($item->summary == '')
{
$descr = strip_html_tags($item->description);
}
else
{
$descr = strip_html_tags($item->summary);
}
$content = $item->children("http://purl.org/rss/1.0/modules/content/");
$content = $content->encoded;
if($content == '')
{
if(($content instanceof SimpleXMLElement) && count($content->children()) != 0)
{
$ret = format($content);
$content = strip_tags($ret);
}
}
if($content == '')
$content = $descr;
$dc = $item->children("http://purl.org/dc/elements/1.1/");
$author = $dc->creator;
?>
Order a Poster in Time for Christmas
(Click to see the entire piece )
New York City artist Ray Sumser's Characternity is a massive digital image created from over 3,000 visual pop culture references. It features characters from blockbuster cinema, comic books, cartoons, video games and the breadth of visual culture and art. From Mickey Mouse to Moby Dick, Super Mario to Superman, and Godzilla to Galactus, it can be hard to come up with fictional icons not in the picture.
Prints can be ordered online .
Permalink
. - .
Today's In depth News
. - .
Email a Friend
. - .
Feedback
Search interbiznet: