NAVIGATIE

Freetime overzicht
Zoeken


  RUBRIEKEN

FAQ / Help
Wat mag niet?
WZL Wedstrijden
WZL Chat
WZL Toolbar
WZL Statistieken
WZL leden
WZL shop
E-cards

RSS

Fun-feed
Babe-feed
Stud-feed

Een groot aantal pokerrooms geven de mogelijkheid om poker te spelen op internet en geld te storten via het veilige iDeal betaalsysteem.
Overzicht » Computer » Programmeren » php mysterie
Je moet ingelogd zijn om te kunnen posten...

Login gegevens
Gebruikersnaam
Wachtwoord



Nog geen lid van de WzL-groep? Lid worden!
Wachtwoord vergeten? Stuur mijn wachtwoord! | Info...
Origineel bericht
Losealot
Sinds 24/9/2004
T: 55 R: 1358
10/5/2005 - 18:23u Quote
om de één of andere reden, doet hij na het includen van onderstaand bestand nix meer, dus als ik dit include voert hij geen code meer uit die eronder staat
<?

// URL RSS file
$rss_file = "http://www.johnandjohn.nl/rss.php";
//aantal headlines
$max_headlines = 1;



// Class with all the <item> and <channel> variables which will hold the information
// and parsing functions
class rss_parser {
// Flag tells which tag we enter
var $flag = 0;
var $tag = "";
// used for checking the for loop, how many items we got
var $cnt=0;

// How many news lines do you want?
var $max_lines;

// <item> iformation
var $title = " ";
var $description = " ";
var $link = " ";
var $pubdate = " ";
// </item>

// <channel> information
var $channel_copyright = "";
var $channel_managingeditor = "";
var $channel_language = "";
var $channel_lastbuilddate = "";
// </channel>


function set_max($max) {
$this->max_lines = $max+1;
}
// Function for start tag such as <item> and <channel>
function startElement($parser, $tagname, $attributes) {
$this->tag = $tagname;
if($this->tag == "CHANNEL" {
$this->flag = 1;
}
elseif($this->tag == "ITEM" {
$this->flag = 2;
$this->cnt++;
}
elseif($this->tag == "IMAGE"{
$this->flag = 3; // Dummy since we dont use it
}
}

// Function for end tag such as </item> and </channel>
function endElement($parser, $tagname) {

// If we enter </item>
if($tagname == "ITEM" {
if($this->cnt == $this->max_lines) {
exit();
}

if(empty($this->description)) $this->description = "none";
if(empty($this->pubdate)) $this->pubdate = "unknown";

// Show the news
echo(trim($this->description));
// You could also show the Publication date....

// Empty the vars for new values
unset($this->title);
unset($this->description);
unset($this->link);
unset($this->pubdate);

}
// If we enter </channel>
elseif($tagname == "CHANNEL" {
if(empty($this->channel_copyright)) $this->copyright = "unknown";
if(empty($this->channel_managingeditor)) $this->channel_managingeditor = "unknown";
if(empty($this->channel_language)) $this->channel_language = "unknown";
if(empty($this->channel_lastbuilddate)) $this->channel_lastbuilddate = "unknown";

// We could show the RSS information here, it's up to yourself do it
}
}

// Collect information and put it in the variables
function characterData($parser, $data) {

if($this->flag == 1) { // entering <channel>
switch($this->tag) {
case "LANGUAGE":
$this->channel_language .= $data;
break;
case "LASTBUILDDATE":
$this->channel_lastbuilddate .= $data;
break;
case "COPYRIGHT":
$this->channel_copyright .= $data;
break;
case "MANAGINGEDITOR":
$this->channel_managingeditor .= $data;
break;
}
}
elseif($this->flag == 2) {
switch($this->tag) { // entering <item>
case "TITLE":
if(isset($this->title)) $this->title .= $data;
break;
case "DESCRIPTION":
if(isset($this->description)) $this->description .= $data;
break;
case "LINK":
if(isset($this->link)) $this->link .= $data;
break;
case "PUBDATE":
if(isset($this->pubdate)) $this->pubdate .= $data;
break;
}
}
}
}

// Create XML support and setup xml parser
$xp = xml_parser_create();
$rss_parser = new rss_parser();
xml_set_object($xp,$rss_parser);

// Ignore whitespaces
xml_parser_set_option($xp, XML_OPTION_SKIP_WHITE, TRUE);

// Setup the start and end functions (Event handlers)
xml_set_element_handler($xp, "startElement", "endElement";
xml_set_character_data_handler($xp, "characterData";

$rss_parser->set_max($max_headlines);

// Open xml file which contains the RSS info
if($fp = @fopen($rss_file,"r") {
fflush($fp);

// Read it in chunks of 4 kilobytes
while($data = fread($fp, 4096)) {
if(!(xml_parse($xp, trim($data), feof($fp))))
die(sprintf("%s <b>%s</b>",PARSE, $rss_file));
}
// Close file pointer and free up the RSS parser cache info
fclose($fp);
xml_parser_free($xp);
}
else // Error opening RSS file
die(sprintf("%s <b>%s</b>",OPEN,$rss_file));
?>


de bedoeling van dit script is de laatste nieuwe john and john cartoon automatisch op men website te hebben