3nd3r Posted March 4, 2002 Share Posted March 4, 2002 here is the error Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /hsphere/local/home/neonerds/<< spam >>/staff/users/3nd3r/ad/rsslib.php on line 78 Fatal error: Call to undefined function: listrdf() in /hsphere/local/home/neonerds/<< spam >>/staff/users/3nd3r/ad/slashdot.php on line 37 http://<< spam >>/staff/users/3nd3r/ad/slashdot.php line 78: $fp = fopen($newsdir . $rdf, "r"); line 37: listrdf("slashdot.rdf"); any ideas? here is the whole file: http://<< spam >>/staff/users/3nd3r/headlines.zip Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 ne1 at all? Link to comment Share on other sites More sharing options...
0 skooter Posted March 4, 2002 Share Posted March 4, 2002 i just ran it on my computer (Xitamai+latest php) and it runs fine (albeit not finding files that should be there - non fatal) it gets headlines from slashdot Scientific American Article: Internet-Spanning OS Captain Crunch's New Boxes, Part II The Teddy Borg is Alive! Will CS Students Switch From Microsoft? 1086 Domesday Book Outlives 1986 Electronic Rival Phil Long and Open Courseware U.S. Cybersquatting Law Goes Global The Rise of CSI Criticize Online, Get Fined NTT to Start i-mode Services in U.S. Search Slashdot Link to comment Share on other sites More sharing options...
0 Weasel Posted March 4, 2002 Share Posted March 4, 2002 I dunno what the error is, but if you want I'll send you the php script that works on my server. here's what it looks like E-mail me if you want it :) Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 I dont see what u did to it.... Link to comment Share on other sites More sharing options...
0 gregor Posted March 4, 2002 Share Posted March 4, 2002 copy paste the whole php code in here with the help of tags, then we will se what's wrong. Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 here is the code #1 rsslib.php <?PHP /* RSSLIB 1.1 Original Author: Steve Yelvington ([url="http://yelvington.com/"]http://yelvington.com/[/url]) Modifications by Bob Zoller (bob@helpermonkey.org): - use fsockopen() instead of fopen() to utilize timeouts - fixed bug in makebullet() that caused output to break - added code to customize the link list output a bit - various configuation options added Bugfix by Neill Newman (njnewm@essex.ac.uk): - changed it to use PHP's parse_url() function, rather than my crappy egrep stuff ;) Name Change by deltab (deltab@psy.ed.asu.edu): - Thanks for the history lesson! rdflib was renamed to rsslib. Usage example: getrdf("http://slashdot.org/slashdot.rdf", 30); listrdf("slashdot.rdf"); Where 30 is the number of minutes you wish to cache the page for before making another request The configuration options should explain themselves. Bugs: None known.. please report to [email=bob@helpermonkey.org]bob@helpermonkey.org[/email] */ $newsdir = "$GLOBALS[DOCUMENT_ROOT]/rdf/"; // store temp files here (make sure webserver has write permission!) $timeout = 5; // number of seconds to wait for a connection $font_face = "Tahoma"; //font face $font_color = ""; //font color $link_color = ""; //link color $font_size = "1"; //font size function getrdf($rdf,$agelimit) { global $newsdir, $timeout; // convert agelimit to seconds $agelimit *= 60; $timestamp = filectime(basename($rdf)); $age = time() - $timestamp; if($age > $agelimit) { $url = parse_url($rdf); $fp = fsockopen($url['host'], "80", &$errno, &$errstr, $timeout); if (!$fp) return; //just quit on error else { $local = fopen($newsdir . basename($rdf), "w"); if (!$local) return; //just quit on error fputs($fp, "GET /" . $url['path'] . " HTTP/1.0rnrn"); while(!feof($fp)) fwrite($local, fgets($fp, 128)); fclose($local); } } } function makebullet($item) { global $font_face, $font_color, $font_size, $link_color; $link = ereg_replace(".*","",$item); $link = ereg_replace(".*","",$link); $title = ereg_replace(".*","",$item); $title = ereg_replace(".*","",$title); if ($title && substr($link, 0, 4) == "http") echo " [*][url="$link"]$title[/url]n"; } function listrdf($rdf) { global $newsdir; $fp = fopen($newsdir . $rdf, "r"); if (!$fp) return; //just quit on error $pagetext = fread($fp, filesize($newsdir . $rdf)); fclose($fp); // kill the crud at the top and bottom $pagetext = ereg_replace("<?xml.*/image>","",$pagetext); $pagetext = ereg_replace("*","",$pagetext); $pagetext = chop($pagetext); // make an array and walk it, printing out the item $items = explode("",$pagetext); array_walk($items, 'makebullet'); } ?> Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 '); <? require('rsslib.php'); getrdf("http://slashdot.org/slashdot.rdf", 30); listrdf("slashdot.rdf"); ?> Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 '); <? require('rsslib.php'); getrdf("http://arstechnica.com/etc/rdf/ars.rdf", 30); listrdf("ars.rdf"); ?> Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 last one... style.css body, { cursor: default; font-family: lucida sans unicode; font-size: 11px; color: #000000; margin-left: 1; margin-top: 0; margin-bottom: 0; margin-right: 0 } p, div, span, li, ul, ol, td, th { font-family: lucida sans unicode; font-size: 11px; color: #000000 } input, select, textarea { font-family: lucida sans unicode; font-size: 10px; height: 17 } a:link { font-family: lucida sans unicode; font-size: 11px; text-decoration: none; color: #000000 } a:visited { font-family: lucida sans unicode; font-size: 11px; text-decoration: none; color: #000000 } a:hover { font-family: lucida sans unicode; font-size: 11px; color: #ABAD81 } Link to comment Share on other sites More sharing options...
0 gregor Posted March 4, 2002 Share Posted March 4, 2002 your problem is the file rsslib.php. it's the function "listrdf", which is problematic. when we look at the line 78 in this file we see: <pre>$fp = fopen($newsdir . $rdf, "r");</pre> i know there is nothing wrong with this line,.. so let's check one line above and one bellow this line: above: <pre>global $newsdir;</pre> -- looks ok! bellow: <pre>if (!$fp) return; //just quit on error</pre> -- looks ok to! but you can try the "return" with "return 0" or "return false". if this doesn't work,... try bugging the server admins. it looks like simething isn't working as it should be on this server. (maybe new php version (4.1.2) will help) i also tried it @ home on iis & php and it works. if you don't get it to work... contact me,.. and i will make new script.. well.. if you really really want to ;) Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 im still getting nothing...... errrr my head hurts..... what did u mean by "it's the function "listrdf", which is problematic"? Link to comment Share on other sites More sharing options...
0 gregor Posted March 4, 2002 Share Posted March 4, 2002 that it didn't matter if it has reported you an error in slashdot.php. it's only 1st error that matters. what about ars.php? does this file works okay? if it does, then try also other news sources, otherwise,... the x-files must be reopened again :p Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 4, 2002 Author Share Posted March 4, 2002 ars.php gives me these errors: Warning: fopen("/hsphere/local/home/neonerds/<< spam >>/rdf/ars.rdf","w") - No such file or directory in /hsphere/local/home/neonerds/<< spam >>/staff/users/3nd3r/ad/rsslib.php on line 54 Warning: fopen("/hsphere/local/home/neonerds/<< spam >>/rdf/ars.rdf","r") - No such file or directory in /hsphere/local/home/neonerds/<< spam >>/staff/users/3nd3r/ad/rsslib.php on line 78 Link to comment Share on other sites More sharing options...
0 zivan56 Posted March 8, 2002 Share Posted March 8, 2002 Are you sure that the file /hsphere/local/home/neonerds/<< spam >>/rdf/slashdot.rdf exists? Because it says no such file or dir. Might not be correct case or something. Link to comment Share on other sites More sharing options...
0 3nd3r Posted March 8, 2002 Author Share Posted March 8, 2002 w000000000000tttttt!!!!!!!!!!!!! it works!!!!!!!!!!!!!!!!!!!!!!!!!! SPANKS ALOT GUYS!!!!!!! http://<< spam >>/staff/users/3nd3r/ad/slashdot.php Link to comment Share on other sites More sharing options...
0 skooter Posted March 8, 2002 Share Posted March 8, 2002 you're elite.:bandit: Link to comment Share on other sites More sharing options...
Question
3nd3r
here is the error
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /hsphere/local/home/neonerds/<< spam >>/staff/users/3nd3r/ad/rsslib.php on line 78
Fatal error: Call to undefined function: listrdf() in /hsphere/local/home/neonerds/<< spam >>/staff/users/3nd3r/ad/slashdot.php on line 37
http://<< spam >>/staff/users/3nd3r/ad/slashdot.php
line 78:
$fp = fopen($newsdir . $rdf, "r");
line 37:
listrdf("slashdot.rdf");
any ideas?
here is the whole file:
http://<< spam >>/staff/users/3nd3r/headlines.zip
Link to comment
Share on other sites
16 answers to this question
Recommended Posts