Integrate Sphider search engine with CodeIgniter

百般思念 提交于 2019-12-12 01:59:31

问题


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

Someone have a solution for this?


回答1:


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

-application

-sphider

-system

-etc

Make sure set database setting in sphider folder /sphider/setting/database.php

if u r using .htaccess then add sphider folder to it.

Then Make One controller in application like this

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 are done with indexing.



来源:https://stackoverflow.com/questions/26957556/integrate-sphider-search-engine-with-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!