0

When you insert your website link, it will show you your site's robots.txt but will give error on top:

Deprecated: Function eregi() is deprecated in /home/hjlhvqyy/public_html/fastseoindia/klib/k_functions_http.php on line 101

Deprecated: Function eregi() is deprecated in /home/hjlhvqyy/public_html/fastseoindia/klib/k_functions_http.php on line 105

My code:

if ((eregi( "^http://",$url))) //line 101 
{
    $url = substr($url,7);
}
elseif((eregi( "^https://",$url))) //line 105
{
    $url = substr($url,8);
}

How can I resolve this?

Community
  • 1
  • 1

2 Answers2

0

This is because the eregi() function is deprecated. Use preg_match() OR stripos() instead.

Sumit Bijvani
  • 8,154
  • 17
  • 50
  • 82
0

I'd recommend you move over to preg_match, unless you have a good reason not to.

It would have to be a pretty darn good reason though.

Aside from that, this doesn't even really need to use a regular expression to achieve your goal.

you could quite easily use a if(0 === strpos()) to check for the existance of either, and then clear it out. EG

if(0 === strpos('http://', $str))
{
  $str = str_replace('http://', $str);
}else if(0 === strpos('https://', $str))
{
 $str = str_replace('https://', $str);
}
Joel Small
  • 187
  • 1
  • 5
  • The question is a dupe of tens of other questions, I believe people should stop answering or there'll be no point in closing as duplicate – Damien Pirsy Nov 05 '13 at 06:24