Depriciated Function in PHP 5.3 - ereg & eregi
-
Friends , I have a code which uses Depreciated functions: I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG.. Please Help.. :sigh: if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) { $httpcode = $regs[2]; full_httpcode = $regs[1]; if ($httpcode <> 2 && $httpcode <> 3) { $status['state'] = "Unreachable: http $full_httpcode"; $linkstate = "Unreachable"; } } if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) { $status['path'] = $regs[1]; $status['state'] = "Relocation: http $full_httpcode"; fclose($fp); return $status; } if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) { $status['date'] = $regs[1]; } if (eregi("Content-Type:", $answer)) { $content = $answer; $answer = ''; break; } if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) { if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') { $status['content'] = 'text'; $status['state'] = 'ok'; } else if ($regs[1] == 'application/pdf' && $index_pdf == 1) { $status['content'] = 'pdf'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) { $status['content'] = 'doc'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) { $status['content'] = 'xls'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) { $status['content'] = 'ppt'; $status['state'] = 'ok'; } else { $status['state'] = "Not text or html"; } Please HELP me soon ..please REPLY!!! :((
-
Friends , I have a code which uses Depreciated functions: I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG.. Please Help.. :sigh: if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) { $httpcode = $regs[2]; full_httpcode = $regs[1]; if ($httpcode <> 2 && $httpcode <> 3) { $status['state'] = "Unreachable: http $full_httpcode"; $linkstate = "Unreachable"; } } if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) { $status['path'] = $regs[1]; $status['state'] = "Relocation: http $full_httpcode"; fclose($fp); return $status; } if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) { $status['date'] = $regs[1]; } if (eregi("Content-Type:", $answer)) { $content = $answer; $answer = ''; break; } if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) { if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') { $status['content'] = 'text'; $status['state'] = 'ok'; } else if ($regs[1] == 'application/pdf' && $index_pdf == 1) { $status['content'] = 'pdf'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) { $status['content'] = 'doc'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) { $status['content'] = 'xls'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) { $status['content'] = 'ppt'; $status['state'] = 'ok'; } else { $status['state'] = "Not text or html"; } Please HELP me soon ..please REPLY!!! :((
is Google not working where you are? it gave me many links including this one[^]. :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
is Google not working where you are? it gave me many links including this one[^]. :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
Well friend i am googling from 5 days. And i have found many links and studied them too. and these BOLD queries that i have mentioned are not being able to be resolved by me.. Actually i have to look for alternative for these expression!!! Hope u can help....with some solution or with a link which could guide me how to resolve them!! Its a new change by PHP and I can't catch it so soon.. So please help me Or you can do another thing... I am using XAMPP with php 5.3 is there any way to stop displaying those deprecated errors
-
Well friend i am googling from 5 days. And i have found many links and studied them too. and these BOLD queries that i have mentioned are not being able to be resolved by me.. Actually i have to look for alternative for these expression!!! Hope u can help....with some solution or with a link which could guide me how to resolve them!! Its a new change by PHP and I can't catch it so soon.. So please help me Or you can do another thing... I am using XAMPP with php 5.3 is there any way to stop displaying those deprecated errors
I use XAMPP myself, however I don't want to hide error or warning messsages, I work on my code to avoid them in the first place. From the link I provided it seems the new ereg and the old preg stuff is very similar; so I suggest you study where they differ and fix things in your code. Start with the very first occurence and fix that. From then on, it should be easy. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
Friends , I have a code which uses Depreciated functions: I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG.. Please Help.. :sigh: if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) { $httpcode = $regs[2]; full_httpcode = $regs[1]; if ($httpcode <> 2 && $httpcode <> 3) { $status['state'] = "Unreachable: http $full_httpcode"; $linkstate = "Unreachable"; } } if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) { $status['path'] = $regs[1]; $status['state'] = "Relocation: http $full_httpcode"; fclose($fp); return $status; } if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) { $status['date'] = $regs[1]; } if (eregi("Content-Type:", $answer)) { $content = $answer; $answer = ''; break; } if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) { if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') { $status['content'] = 'text'; $status['state'] = 'ok'; } else if ($regs[1] == 'application/pdf' && $index_pdf == 1) { $status['content'] = 'pdf'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) { $status['content'] = 'doc'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) { $status['content'] = 'xls'; $status['state'] = 'ok'; } else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) { $status['content'] = 'ppt'; $status['state'] = 'ok'; } else { $status['state'] = "Not text or html"; } Please HELP me soon ..please REPLY!!! :((
USE : PERL REGEX , preg_replace,preg_match; HONEY