jduffell Posted January 23, 2010 Share Posted January 23, 2010 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, jurgen.strydom@gmail.com 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 } } ?> Quote Link to comment Share on other sites More sharing options...
ldb358 Posted January 23, 2010 Share Posted January 23, 2010 according to the manual (http://php.net/manual/en/function.simplexml-load-file.php) the function throw a warning for each xml error Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.