卷发杀死进程

时间:2018-11-29 11:26:26

标签: elasticsearch curl process

有没有办法“消除”卷曲过程?

我已经尝试过:curl -X GET 'http://localhost:9200'

但是我有这个错误:curl: (7) Failed connect to localhost:9200; Connection refused

tryied this solution但是我没有弹性搜索,所以我做不到 :sudo service elasticsearch restart

我有:Failed to restart elasticsearch.service: Unit elasticsearch.service not found.

ps:我想这样做是因为,当我无法使用curl_init之类的curl函数时,在重新启动计算机之前,我将无法再访问该请求...使我失败的代码... (如果您想看)

function CallAPI($method, $url, $data = false)
{
    $curl = curl_init();

    switch ($method)
    {
        case "POST":
            curl_setopt($curl, CURLOPT_POST, 1);

            if ($data)
                curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
            break;
        case "PUT":
            curl_setopt($curl, CURLOPT_PUT, 1);
            break;
        default:
            if ($data)
                $url = sprintf("%s?%s", $url, http_build_query($data));
    }

    // Optional Authentication:
    //curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    //curl_setopt($curl, CURLOPT_USERPWD, "username:password");

    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

    $result = curl_exec($curl);

    curl_close($curl);

    return $result;
}

0 个答案:

没有答案