Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Rss2html error redirect help
01-22-2012, 11:47 AM #1
- Join Date
- Jan 2012
- Thanked 0 Times in 0 Posts
Rss2html error redirect help
I am hoping someone can help me, i am using the rss2html script from feedforall.
I display rss feeds on my website from usgs regarding eathquakes etc.
One of my feeds went down their end and cauded my page to display the error report that looked very messy and untidy. I contacted them for help and they told me too ad this
<?PHP // // rss2html.php RSS feed to HTML webpage script // // Copyright 2004-2007 NotePage, Inc. // http://www.feedforall.com // // This script may be used and modified freely for business or personal use // This script may not be resold in any form // This script may only be redistributed in its original form // // // $Id: rss2html.php,v 3.15 2010/03/16 22:31:38 housley Exp $ // // // ========================================================================== // Configuration options // ========================================================================== // // Set the following variable useFopenURL to one if you want/need to use // fopen() instead of CURL or FeedForAll_fopen() $useFopenURL = 0; // // If XLMFILE is passed as part of the URL, XMLFILE=, then it will be used // otherwise the the file below is used. //$XMLfilename = "http://examlple.com/sample.xml"; $XMLfilename = "http://earthquake.usgs.gov/earthquakes/catalogs/eqs1day-M2.5.xml"; // // If TEMPLATE is passed as part of the URL. TEMPLATE=, then it will be used // otherwise the the file below is used. //$TEMPLATEfilename = "http://examlple.com/sample-template.html"; $TEMPLATEfilename = "template.php"; // // Since some feeds may have titles or descriptins in the feed or items that // are longer then want fits in your HTML page it is possible to trim them // with the following 4 variables. A values of 0 (ZERO) displays the full // length. // CAUTION: Do not limit a title or description that has HTML in it, the // will not produce a valid HTML page. $limitFeedTitleLength = 0; // Not limited, in the URL as FeedTitleLength= $limitFeedDescriptionLength = 0; // Not limited, in the URL as FeedDescriptionLength= $limitItemTitleLength = 0; // Not limited, in the URL as ItemTitleLength= $limitItemDescriptionLength = 0; // Not limited, in the URL as ItemDescriptionLength= // // date() function documented http://www.php.net/manual/en/function.date.php $LongDateFormat = "F jS, Y"; // ie, "Jan 21st, 2004" $ShortDateFormat = "m/d/Y"; // ie, "1/21/2004" //$ShortDateFormat = "d/m/Y"; // ie, "21/1/2004" $LongTimeFormat = "H:i:s T O"; // ie, "13:24:30 EDT -0400" $ShortTimeFormat = "h:i A"; // ie, "1:24 PM"
Now my question is can i change that piece of code so that if there is an error it could auto redirect to a custom made error page so it looks more tidy?
Any help would be great thankyou in advance.
01-22-2012, 04:30 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Not from this script you can't.
The processing script that will be in use isn't gracefully handling errors, and error reporting settings or hiding them doesn't actually fix the error it just stops you from seeing them. You need to identify where the error is (which can be done by providing it with a known bad location to lookup the data), and then you can handle the error from here. This will be an oversight of whatever technique is in use to connect to the remote feed. The code will be written to connect, and continue assuming that the connection was successful (ie something like:
). The problem is there is no guarantee that fopen was successful, so an attempted read will of course fail.PHP Code:
$fp = fopen('location', 'r');
You'll need to post the processing script in order to identify where the error is.