示例#1
0
function ra_get_keywords($content, $post_id)
{
    global $wpdb;
    $keywords = ra_fetch_row("keywords_" . $post_id);
    if (!empty($keywords)) {
        return $keywords;
    } else {
        $url = CLOUDAPI_URL;
        $rpc = new PHPRPC_Client();
        $rpc->setProxy(NULL);
        $rpc->useService($url);
        $ret = $rpc->api_getkeywords(strip_tags($content), 8, "n");
        $keywords = array();
        foreach ($ret["data"] as $v) {
            $keywords[] = $v[0];
        }
        ra_set_row("keywords_" . $post_id, $keywords);
        return $keywords;
    }
}