Jump to content

Warning: simplexml_load_file()


jduffell

Recommended Posts

Hi posted a question about my problem earlier, but I thought I'd best add the code, I've taken out my flickr Key though.

 

I'm getting a warning regarding my the XML file loaded, but if I'm completely honest I have no idea what to change to get it to work.

 

Error =

Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/jamesduf/public_html/social/index.php

 

It works fine on my local host, the problem comes when placing it on a live server.

 

Cheers for any help

 

<?php
/*************************************************
www.strydominc.za.net
Created by Jurgen Strydom, 19-08-2006, [email protected]
Read the readme.txt
Version 1.01, 19-08-2006
***********************************************************/
?>
<link href="pagefloat.css" rel="stylesheet" type="text/css">
<?php
//Stuff you should update for your script
$api_key = ""; // get yours at http://flickr.com/services/api/key.gne
$my_id = "97887293@N00"; // use idgetr: http://idgettr.com/ to find yours if you already changed it to a name
$rows = 12;
//Let the code do the walking from here on
$photos = ($rows);
if (empty($_REQUEST['n'])) {
$pagenum = 1;
} else {
$pagenum = $_REQUEST['n'];
}
//http://static.flickr.com/{server-id}/{id}_{secret}_[mstb].jpg //how the url is created for the images
$xml = simplexml_load_file("http://flickr.com/services/rest/?method=flickr.people.getPublicPhotos&user_id=$my_id&api_key=$api_key&per_page=$photos&page=$pagenum");
$total = $xml->photos['total'];
$pages = $total % $photos;
$pages = ($total + $photos - $pages) / $photos;

?>
<?php
for ($k = 1; $k<=$pages; $k++) { ?>
<?php
?>
<?php if ($k == $pagenum) {
} else {
} ?>

<?php }
?>
<?php

if (($pagenum * $photos) > $total) {
$to = $total % $photos;
} else { $to = $photos; }
for ($k = 0; $k<$to; $k++) {
if (($k % 2) == 0) {
?>
<?php } else {?>
<?php }
?>
<a href="
<?php
echo "http://static.flickr.com/";
echo $xml->photos->photo[$k]['server'];
echo "/";
echo $xml->photos->photo[$k]['id'];
echo "_";
echo $xml->photos->photo[$k]['secret'];
echo ".jpg";
?>">
<img src="<?php
echo "http://static.flickr.com/";
echo $xml->photos->photo[$k]['server'];
echo "/";
echo $xml->photos->photo[$k]['id'];
echo "_";
echo $xml->photos->photo[$k]['secret'];
echo "_s.jpg";
?>"
alt="<?php echo $xml->photos->photo[$k]['title'] ?>"
rel"lightbox"
width="63px"
height="63px"/>
</a>
<?php
if (($k) == 1) {
?>
<?php
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/189547-warning-simplexml_load_file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.