rastaman46 Posted April 14, 2012 Share Posted April 14, 2012 How to solve this error out PHP Deprecated: Function ereg_replace() is deprecated in using this code $shoutcast_on_off =''; $scsuccs = ''; $listenlink = ''.$scdef.''; $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); if(!$scfp) { $scsuccs=1; } $page = ''; if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $page .= fgets($scfp, 1000); } $loop = array("STREAMSTATUS"); $y=0; while($loop[$y]!=''){ $pageed = ereg_replace(".*<$loop[$y]>", "", $page); $scphp = strtolower($loop[$y]); $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); $y++; } fclose($scfp); } $online1 = ''; if ($streamstatus == "1") { $online1 = '<center><img src="'.$BASEURL.'/styles/'.$theme.'/theme_images/DJ.png" border="0" height="150"></center><br> <center><a href="'.$BASEURL.':'.$scport.'/listen.pls"><img src="'.$BASEURL.'/styles/'.$theme.'/theme_images/klausom.png" width="150px" height="auto"></a></center>'; } else { $online2 = ''; $online2 = '<center><img src="'.$BASEURL.'/styles/'.$theme.'/theme_images/off.png" border="0" height="150"></center>'; } // BEGIN Plugin: shoutcast_on_off $shoutcast_on_off = $online1.$online2; // END Plugin: shoutcast_on_off eval("\$shoutcast = \"".$TSUE['TSUE_Template']->LoadTemplate('shoutcast')."\";"); return $shoutcast; Quote Link to comment https://forums.phpfreaks.com/topic/260947-php-deprecated-function-ereg_replace-is-deprecated-in/ Share on other sites More sharing options...
gizmola Posted April 14, 2012 Share Posted April 14, 2012 Correct, the function is deprecated -- which means that the PHP team has decided to remove it entirely from the language in the future. For now, this is only a warning, and you can turn down the errorlevel to not display or log warnings. You could also find a corresponding preg_ function and recode to it if you want to correct the problem going forward. Quote Link to comment https://forums.phpfreaks.com/topic/260947-php-deprecated-function-ereg_replace-is-deprecated-in/#findComment-1337397 Share on other sites More sharing options...
rastaman46 Posted April 14, 2012 Author Share Posted April 14, 2012 if im use preg im get white page Quote Link to comment https://forums.phpfreaks.com/topic/260947-php-deprecated-function-ereg_replace-is-deprecated-in/#findComment-1337398 Share on other sites More sharing options...
rastaman46 Posted April 14, 2012 Author Share Posted April 14, 2012 PHP Warning: preg_replace() [function.preg-replace]: Unknown modifier '.' Quote Link to comment https://forums.phpfreaks.com/topic/260947-php-deprecated-function-ereg_replace-is-deprecated-in/#findComment-1337399 Share on other sites More sharing options...
gizmola Posted April 14, 2012 Share Posted April 14, 2012 The regex for the preg_* functions requires a delimitter character around the regex. Most people start with '/'. So for example, from the code, the first replacement would be: $pageed = preg_replace("/.*/", "", $page); Quote Link to comment https://forums.phpfreaks.com/topic/260947-php-deprecated-function-ereg_replace-is-deprecated-in/#findComment-1337410 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.