Click to See Complete Forum and Search --> : ERROR: DOMDocument::load() [function.DOMDocument-load]:


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

PeejAvery
March 11th, 2008, 03:09 PM
It appears as though it is not finding the URL. What happens if you try http://pumatalk.com/blog/?feed=rss2 instead?

Joey_123
March 11th, 2008, 04:19 PM
Hot DANG :) it worked ;) thanks alot mate ;)

PeejAvery
March 11th, 2008, 04:49 PM
Your welcome. You see, the one feed was just a redirector. So the DOMDocument class was not able to see it as a true feed.

Joey_123
March 12th, 2008, 09:40 AM
Hey Peej,

Thanks again, it did work! Now, I just tired it out - I posted a article on my blog: www.pumatalk.com/blog basically what my script does on the homepage is, just creates a snapshot with a title to post the latest 5 posts of the blog on the homepage. But now, look at the error I'm getting.


Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home3/injoefa/public_html/pumatalk/index.php on line 256

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'http://img31.picoodle.com/img/img31/4/3/12/f_Picture3m_1f7bc73.png' is not a valid JPEG file in /home3/injoefa/public_html/pumatalk/index.php on line 256

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home3/injoefa/public_html/pumatalk/index.php on line 258

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home3/injoefa/public_html/pumatalk/index.php on line 260

Warning: imagecreatefromjpeg(blog_images/f_Picture3m_1f7bc73.png) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home3/injoefa/public_html/pumatalk/index.php on line 268

Warning: getimagesize(blog_images/f_Picture3m_1f7bc73.png) [function.getimagesize]: failed to open stream: No such file or directory in /home3/injoefa/public_html/pumatalk/index.php on line 272

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home3/injoefa/public_html/pumatalk/index.php on line 292

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home3/injoefa/public_html/pumatalk/index.php on line 300


Again here is the code from lines 156 to 318


</div></div></div></div></div>

<div class="content">

<div class="content_holder">

<div class="blog">

<ul>

<?php

//folder for images

$folder = 'blog_images/';



$doc = new DOMDocument();

$doc->load( 'http://pumatalk.com/blog/?feed=rss2' );



$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>

Any thoughts on how I can this error Peej?

-Joey

Joey_123
March 12th, 2008, 09:52 AM
ah figured it out... the script only makes screenshots of .JPG and not .PNG

good to know :)
-Joey

PeejAvery
March 12th, 2008, 11:41 AM
With a little bit of work, you can change that around. Take a look at the thumbnail.php section of Photo album with thumbnail script (http://www.peejavery.com/coding/php/album.php) on my website. I have JPG, PNG, and GIF support for it. You could easily learn from that portion of the script.

Joey_123
March 17th, 2008, 10:32 AM
Hey Folks,

Can anyone have a look at my homepage - http://www.PUMATALK.com and let me know if the images are loading properly or if u see any code errors?

Here's what i see so far.. not sure as to why the images aren't loading :(

http://i30.tinypic.com/vqk31v.png

Thanks.
-Joey

PeejAvery
March 17th, 2008, 12:32 PM
Images work fine for me. Do you have an adblocker rejecting them? Right-click on them and copy the image location. Then you can see what is wrong.