Joey_123
March 11th, 2008, 02:19 PM
Hey Folks,
I have been just going nuts trying to figure out what the problem is :(- hopefully I'll get some help from the CODE GURUS :)
Here's the error
Warning: DOMDocument::load() [function.DOMDocument-load]: Document is empty in http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169, line: 1 in /home3/injoefa/public_html/pumatalk/index.php on line 176
Warning: DOMDocument::load() [function.DOMDocument-load]: Start tag expected, '<' not found in http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169, line: 1 in /home3/injoefa/public_html/pumatalk/index.php on line 176
Now here's whats' going on: http://www.pumatalk.com <-- thats' my site check it out.
Ok the error is part of the RSS feeds from my blog here: http://www.pumatalk.com/blog/?feed=rss2
Now what this error thing is supposed to do is take the latest 5 feeds and give a snapshot image along with a title below the image... but for some reason it's not working and no clue why.
What i did was i checked out this link:
http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169
but it just pretty much brought me to my blog rss feed
http://www.pumatalk.com/blog/?feed=rss2
So not sure what to do - i copied the full code for this error and hopefully you gents can help me out.
<div class="content">
<div class="content_holder">
<div class="blog">
<ul>
<?php
//folder for images
$folder = 'blog_images/';
$doc = new DOMDocument();
$doc->load( 'http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169' );
$chanels = $doc->getElementsByTagName( "channel" );
foreach( $chanels as $channel )
{
$itemss = $channel->getElementsByTagName( "item" );
$i = 0;
foreach( $itemss as $items )
{
//get descript
$titles = $items->getElementsByTagName( "title" );
$title = $titles->item(0)->nodeValue;
// cut descript
$string_length = 43;
if (strlen($title)>$string_length)
{
$title = substr(htmlspecialchars(trim($title)), 0, $string_length);
$title = $title.'...';
}
//get url
$links = $items->getElementsByTagName( "link" );
$link = $links->item(0)->nodeValue;
//get url on image
$contents = $items->getElementsByTagName( "encoded" );
$content = $contents->item(0)->nodeValue;
$content = stristr($content, '<img');
$pos = strpos($content, '>');
$content = substr($content,0,$pos);
$content = stristr($content, 'src');
$pos2 = strpos($content, 'g"');
$pos2 = $pos2-4;
$content = substr($content,5,$pos2);
// big image filename
$filename = substr(strrchr($content, "/"), 1);
$full_path = $folder.$filename;
// is there big image
if(!@imagecreatefromjpeg($full_path))
{
// save big imag
$source = imagecreatefromjpeg($content);
imagejpeg($source,$full_path);
imagedestroy($source);
}
// create new image
$thumb = imagecreatetruecolor(138, 76);
$source2 = imagecreatefromjpeg($full_path);
// Get new sizes
list($width, $height) = getimagesize($full_path);
if($width*(76/138)>=$height)
{
$width = $height*(138/76);
}
else
{
$height = $width*(76/138);
}
// Resize and output
imagecopyresampled($thumb, $source2, 0, 0, 0, 0, 138, 76, $width, $height);
$small_name = 'small_'.$filename;
$full_path2 = $folder.$small_name;
imagejpeg($thumb,$full_path2);
imagedestroy($source2); imagedestroy($thumb);
echo '<li><a href='.$link.'><img width=138 height=76 src='.$full_path2.'></a><p><a href='.$link.'>'.$title.'</a></p></li>';
// max number of images
$i=$i+1;
if($i==5)break;
}
}
?>
</ul>
</div>
This is how it should look like.
http://i27.tinypic.com/15pg48w.png
-Joey
I have been just going nuts trying to figure out what the problem is :(- hopefully I'll get some help from the CODE GURUS :)
Here's the error
Warning: DOMDocument::load() [function.DOMDocument-load]: Document is empty in http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169, line: 1 in /home3/injoefa/public_html/pumatalk/index.php on line 176
Warning: DOMDocument::load() [function.DOMDocument-load]: Start tag expected, '<' not found in http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169, line: 1 in /home3/injoefa/public_html/pumatalk/index.php on line 176
Now here's whats' going on: http://www.pumatalk.com <-- thats' my site check it out.
Ok the error is part of the RSS feeds from my blog here: http://www.pumatalk.com/blog/?feed=rss2
Now what this error thing is supposed to do is take the latest 5 feeds and give a snapshot image along with a title below the image... but for some reason it's not working and no clue why.
What i did was i checked out this link:
http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169
but it just pretty much brought me to my blog rss feed
http://www.pumatalk.com/blog/?feed=rss2
So not sure what to do - i copied the full code for this error and hopefully you gents can help me out.
<div class="content">
<div class="content_holder">
<div class="blog">
<ul>
<?php
//folder for images
$folder = 'blog_images/';
$doc = new DOMDocument();
$doc->load( 'http://feedrinse.com/services/rinse/?rinsedurl=027515db7c29e92587cfd8f563695169' );
$chanels = $doc->getElementsByTagName( "channel" );
foreach( $chanels as $channel )
{
$itemss = $channel->getElementsByTagName( "item" );
$i = 0;
foreach( $itemss as $items )
{
//get descript
$titles = $items->getElementsByTagName( "title" );
$title = $titles->item(0)->nodeValue;
// cut descript
$string_length = 43;
if (strlen($title)>$string_length)
{
$title = substr(htmlspecialchars(trim($title)), 0, $string_length);
$title = $title.'...';
}
//get url
$links = $items->getElementsByTagName( "link" );
$link = $links->item(0)->nodeValue;
//get url on image
$contents = $items->getElementsByTagName( "encoded" );
$content = $contents->item(0)->nodeValue;
$content = stristr($content, '<img');
$pos = strpos($content, '>');
$content = substr($content,0,$pos);
$content = stristr($content, 'src');
$pos2 = strpos($content, 'g"');
$pos2 = $pos2-4;
$content = substr($content,5,$pos2);
// big image filename
$filename = substr(strrchr($content, "/"), 1);
$full_path = $folder.$filename;
// is there big image
if(!@imagecreatefromjpeg($full_path))
{
// save big imag
$source = imagecreatefromjpeg($content);
imagejpeg($source,$full_path);
imagedestroy($source);
}
// create new image
$thumb = imagecreatetruecolor(138, 76);
$source2 = imagecreatefromjpeg($full_path);
// Get new sizes
list($width, $height) = getimagesize($full_path);
if($width*(76/138)>=$height)
{
$width = $height*(138/76);
}
else
{
$height = $width*(76/138);
}
// Resize and output
imagecopyresampled($thumb, $source2, 0, 0, 0, 0, 138, 76, $width, $height);
$small_name = 'small_'.$filename;
$full_path2 = $folder.$small_name;
imagejpeg($thumb,$full_path2);
imagedestroy($source2); imagedestroy($thumb);
echo '<li><a href='.$link.'><img width=138 height=76 src='.$full_path2.'></a><p><a href='.$link.'>'.$title.'</a></p></li>';
// max number of images
$i=$i+1;
if($i==5)break;
}
}
?>
</ul>
</div>
This is how it should look like.
http://i27.tinypic.com/15pg48w.png
-Joey