Sphider Search Engine Integration with CodeIgniter

I want to integrate the Sphider search engine with CodeIgniter , but I have no idea how to do this.

Does anyone have a solution for this?

0
source share
1 answer

This can be done using marge core php and codeigniter. put your sphider folder with your application folder

-attachment

-sphider

-system

-etc

Make sure the database parameter is set in the sphider / sphider / setting / database.php folder

if ur using .htaccess then add sphider folder to it.

Then make one controller in the application as follows

public function index()
{
        $url = $this->base_url.'sphider/admin/spider.php';
        $fields = array(
                    'url' => urlencode("URL OF YOUR Page That you want to index"),
                    'soption' => urlencode("level"),
                    'maxlavel' => urlencode("0"),//1,2
                    'reindex' => urlencode("1") //0,1
            );


    $fields_string="";
    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    rtrim($fields_string, '&');

    //open connection
    $ch = curl_init();

    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch,CURLOPT_POST, count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

    //execute post
    //error_reporting(E_ERROR | E_PARSE);
    $result = curl_exec($ch);
    error_reporting(E_ERROR | E_PARSE);
    //close connection
    curl_close($ch);

    redirect("YOUR REDIRECTING URL");
}

}

and you're done with indexing.

+2

Source: https://habr.com/ru/post/1750377/


All Articles