par
jona » 06 nov. 2005, 13:36
Ca ne marche pas peut être estt-ce du à un code satellite je met donc le code complet de la page qui parsse le RSS et qui contient mon href :
<?php
######################################
# GameTrailers.com RSS Parser v1.0 #
# GT RSS feed is © 2005 Gametrailers.com #
# created by [email protected] #
#######################################
// USER SETTINGS
$feedlink = "http://www.gametrailers.com/rss/newestxb360.xml"; //What feed are we going to use?
// TEMPLATE - this code will be repeated for every item, so it's best to use a table, and just have each item take up a row. To insert an element simply input it with { and } around the element name. Element names described on http://www.gametrailers.com/rssexplained.com
$template = '
<tr>
<td align="center"><img border=0 src="{EXINFO:IMAGE}" ></td>
</tr>
<tr>
<td style="font-family:Verdana;font-size:10px"> <b>{TITLE}</b><br> - <a href="http://www.fousdexbox.com/a_redirect_gt.php?url={EXINFO:FILETYPE2:LINK}" target="_blank">[{EXINFO:FILETYPE2:TYPE}] {FILESIZE2MB} MB</a></td>
</tr>';
//*************************************
$feeddata = file_get_contents($feedlink);
$Parser = xml_parser_create();
xml_set_element_handler($Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_handler($Parser, 'CharacterHandler');
$ii = 0; //item counter
//pass the content string to the parser.
if ( !xml_parse($Parser, $feeddata) ) {
$errors .= "| couldn't parse feed ";
}
function StartHandler($Parser, $Elem, $attr) { //this function is called every time a tag is opened
global $insideItem, $data, $this, $ii, $kk, $ll;
if($Elem=="ITEM") {
$ii++;
$kk = ""; // reset movie type counter
$ll = ""; // reset platform counter
$this = ""; //reset item info
$insideItem = ""; //reset item tracker
$this[id] = $ii;
} elseif($Elem=="EXINFO:FILETYPE") {
$kk++;
$insideItem = "";
$insideItem[] = $Elem.$kk;
} elseif($Elem=="EXINFO:PLATFORM") {
$ll++;
$insideItem[] = $Elem.$ll;
} else {
$insideItem[] = $Elem;
}
unset($this[datum]);
}
function CharacterHandler($Parser, $Line) { //this function is called for every line of text in between tags
global $data, $insideItem, $this;
$this[datum] .= $Line;
}
function EndHandler($Parser, $Elem) { //this function is called every time a tag is closed
global $data, $insideItem, $this, $ii;
if($Elem=="ITEM") {
$data[$ii] = $this;
} elseif($Elem=="EXINFO:FILETYPE") {
$key = implode(":", $insideItem);
$this[$key] = $this[datum];
$insideItem = "";
} else {
$key = implode(":", $insideItem);
$this[$key] = $this[datum];
$pop = array_pop($insideItem);
}
$this[datum] = ""; //clear data
}
$ii = 0;
foreach($data as $mov) {
$itemText = $template;
$itemText = str_replace("{FILESIZE1MB}", round(10*$mov['EXINFO:FILETYPE1:FILESIZE']/(1024 * 1024)) / 10, $itemText);
$itemText = str_replace("{FILESIZE2MB}", round(10*$mov['EXINFO:FILETYPE2:FILESIZE']/(1024 * 1024)) / 10, $itemText);
foreach(array_keys($mov) as $key) {
$itemText = str_replace('{'.$key.'}', $mov[$key], $itemText);
}
$ii++;
if($ii < 7) { echo $itemText; }
}
Ca ne marche pas peut être estt-ce du à un code satellite je met donc le code complet de la page qui parsse le RSS et qui contient mon href :
[php]<?php
######################################
# GameTrailers.com RSS Parser v1.0 #
# GT RSS feed is © 2005 Gametrailers.com #
# created by
[email protected] #
#######################################
// USER SETTINGS
$feedlink = "http://www.gametrailers.com/rss/newestxb360.xml"; //What feed are we going to use?
// TEMPLATE - this code will be repeated for every item, so it's best to use a table, and just have each item take up a row. To insert an element simply input it with { and } around the element name. Element names described on http://www.gametrailers.com/rssexplained.com
$template = '
<tr>
<td align="center"><img border=0 src="{EXINFO:IMAGE}" ></td>
</tr>
<tr>
<td style="font-family:Verdana;font-size:10px"> <b>{TITLE}</b><br> - <a href="http://www.fousdexbox.com/a_redirect_gt.php?url={EXINFO:FILETYPE2:LINK}" target="_blank">[{EXINFO:FILETYPE2:TYPE}] {FILESIZE2MB} MB</a></td>
</tr>';
//*************************************
$feeddata = file_get_contents($feedlink);
$Parser = xml_parser_create();
xml_set_element_handler($Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_handler($Parser, 'CharacterHandler');
$ii = 0; //item counter
//pass the content string to the parser.
if ( !xml_parse($Parser, $feeddata) ) {
$errors .= "| couldn't parse feed ";
}
function StartHandler($Parser, $Elem, $attr) { //this function is called every time a tag is opened
global $insideItem, $data, $this, $ii, $kk, $ll;
if($Elem=="ITEM") {
$ii++;
$kk = ""; // reset movie type counter
$ll = ""; // reset platform counter
$this = ""; //reset item info
$insideItem = ""; //reset item tracker
$this[id] = $ii;
} elseif($Elem=="EXINFO:FILETYPE") {
$kk++;
$insideItem = "";
$insideItem[] = $Elem.$kk;
} elseif($Elem=="EXINFO:PLATFORM") {
$ll++;
$insideItem[] = $Elem.$ll;
} else {
$insideItem[] = $Elem;
}
unset($this[datum]);
}
function CharacterHandler($Parser, $Line) { //this function is called for every line of text in between tags
global $data, $insideItem, $this;
$this[datum] .= $Line;
}
function EndHandler($Parser, $Elem) { //this function is called every time a tag is closed
global $data, $insideItem, $this, $ii;
if($Elem=="ITEM") {
$data[$ii] = $this;
} elseif($Elem=="EXINFO:FILETYPE") {
$key = implode(":", $insideItem);
$this[$key] = $this[datum];
$insideItem = "";
} else {
$key = implode(":", $insideItem);
$this[$key] = $this[datum];
$pop = array_pop($insideItem);
}
$this[datum] = ""; //clear data
}
$ii = 0;
foreach($data as $mov) {
$itemText = $template;
$itemText = str_replace("{FILESIZE1MB}", round(10*$mov['EXINFO:FILETYPE1:FILESIZE']/(1024 * 1024)) / 10, $itemText);
$itemText = str_replace("{FILESIZE2MB}", round(10*$mov['EXINFO:FILETYPE2:FILESIZE']/(1024 * 1024)) / 10, $itemText);
foreach(array_keys($mov) as $key) {
$itemText = str_replace('{'.$key.'}', $mov[$key], $itemText);
}
$ii++;
if($ii < 7) { echo $itemText; }
}
[/php]