Ok sous php4 mais pas sous php5

WRInaute occasionnel
Bonjour,
j'ai un soucis avec un script qui m'affiche les sorties ciné sur mon site.
si le serveur est configuré en php 4 le script fonction mais si il est en php5 j'ai cette erreur :
Warning: feof(): supplied argument is not a valid stream resource in /homepages/36/d329215578/htdocs/cinema.php on line 152

voilà le bout de script :
Code:
<?php
$site = "http://www.nord-cinema.com/rss.php";
$fp = @fopen($site,"r");
while(!feof($fp)) $raw .= @fgets($fp, 4096);
fclose($fp);
if( eregi("<item>(.*)</item>", $raw, $rawitems ) ) {
 $items = explode("<item>", $rawitems[0]);
 for( $i = 0; $i < count($items)-1; $i++ ) {
  eregi("<title>(.*)</title>",$items[$i+1], $title );
  eregi("<link>(.*)</link>",$items[$i+1], $url );
  eregi("<image>(.*)</image>",$items[$i+1], $image);
  eregi("<description>(.*)</description>",$items[$i+1], $description);
 $title[1]=utf8_encode($title[1]);
 $description[1]=utf8_encode($description[1]);
  echo "<div class='cinema'><a href=\"".$url[1]."\"><img width=\"100\" border=\"0\" src=\"".$image[1]."\" alt=\"".$title[1]."\" class=\"brd10pxgauche\"></a>";
  echo "<a href=\"".$url[1]."\">".$title[1]."</a><br/>".$description[1]."</div>";
 }
}
?>
 
WRInaute impliqué
fopen() doit retourner une erreur, en l'affichant, tu aura la réponse à ta question
 
WRInaute occasionnel
ok merci.

bon du coup j'ai comme erreurs :
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /homepages/36/d329215578/htdocs/cinema.php on line 151
Warning: fopen(http://www.nord-cinema.com/rss.php) [function.fopen]: failed to open stream: no suitable wrapper could be found in /homepages/36/d329215578/htdocs/cinema.php on line 151
Warning: feof(): supplied argument is not a valid stream resource in /homepages/36/d329215578/htdocs/cinema.php on line 152
Warning: fgets(): supplied argument is not a valid stream resource in /homepages/36/d329215578/htdocs/cinema.php on line 152

pour info je suis hebergé chez 1and1 qui par defaut est en php4. pour passé en php 5 j'ai créé un fichier htaccess dans lequel j'ai mis
AddType x-mapp-php5 .php
 
WRInaute accro
Sur 1&1 tu peux modifier ton php.ini en en créant un à la racine de ton site

memory_limit = 40M
register_globals = Off
allow_url_fopen = 1
allow_url_include = 1
 
WRInaute passionné
rien à voir, mais dans ton code tu utilise eregi.

Cette fonction est dépréciée en PHP5 tu devrais la remplacer par une autre.
 
Discussions similaires
Haut