I am following along a tutorial for a PHP web crawler and I keep getting an error concerning my indexing. PHP tutorial
ERROR:
Notice: Undefined index: path in C:\wamp\www\crawler.php on line 19
Call Stack
# Time Memory Function Location
1 0.0010 260216 {main}( ) ..\crawler.php:0
2 0.0080 730552 crawl_site( ) ..\crawler.php:47
3 1.8320 2344408 perfect_url( ) ..\crawler.php:38
This is the function that is giving the error:
function rel2abs($rel, $base){
if (parse_url($rel, PHP_URL_SCHEME) != ''){
return $rel;
}
if ($rel[0]=='#' || $rel[0]=='?'){
return $base.$rel;
}
extract(parse_url($base));
$path = preg_replace('#/[^/]*$#', '', $path);
if ($rel[0] == '/'){
$path = '';
}
$abs = "$host$path/$rel";
$re = array('#(/.?/)#', '#/(?!..)[^/]+/../#');
for($n=1; $n>0;$abs=preg_replace($re,'/', $abs,-1,$n)){}
$abs=str_replace("../","",$abs);
return $scheme.'://'.$abs;
}
Line 19: $re = array('#(/.?/)#', '#/(?!..)[^/]+/../#');