private function get_links($page) { //get all links form page $all_links = parent::crawl_for_links($this->init_links[$page]); $links = []; //get array values count $count = count($all_links); /* * Array value 0 through 21 are crap and we are not interested in them, so we are gonna discard them. * we are gonna copy array values until we hit page/2 or base url. */ for ($i = 21; $i < $count; $i++) { if ($all_links[$i] == "http://www.puffandpass.co.za/page/2" || $all_links[$i] == "http://www.puffandpass.co.za/") { break; //Stop iterating } else { if ($all_links[$i] != "http://www.puffandpass.co.za/author/webmaster") { $links[] = $all_links[$i]; } } } /* * discard duplicate values and rebase the array values*/ $this->post_links[] = array_values(array_unique($links)); }