• 0

just a little php help please :p


Question

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

  • 0

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

  • 0

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

  • 0

here is the code #1

rsslib.php

&lt;?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 &gt; $agelimit) {

    $url = parse_url($rdf);

    $fp = fsockopen($url['host'], "80", &amp;$errno, &amp;$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 &amp;&amp; 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("&lt;?xml.*/image&gt;","",$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');

}





?&gt;

Link to comment
Share on other sites

  • 0

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

  • 0

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:

&lt;pre&gt;$fp = fopen($newsdir . $rdf, "r");&lt;/pre&gt;

i know there is nothing wrong with this line,.. so let's check one line above and one bellow this line:

above:

&lt;pre&gt;global $newsdir;&lt;/pre&gt;

-- looks ok!

bellow:

&lt;pre&gt;if (!$fp) return; //just quit on error&lt;/pre&gt;

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

  • 0

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

  • 0

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

  • 0

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.