laravel中使用Ixudra\Curl发送数据

2018-08-17  本文已影响0人  不看盛景不叙深情
  $curl = \Curl::to($url)->to($url)
                ->asJsonRequest()
                ->withData([
                    'center_ip' => $center_ip,
                    'machine_code' => $hcode,
                    'action' => $action,
                    'node_uuid' => $nodeUuid
                ])
                ->withTimeout(60)
                ->asJsonResponse()
                ->returnResponseObject();
            $res = $curl->post();
        $certfile = 'client.crt';
        $keyfile= 'client.key';
        $curl = \Curl::to('https://'.$url)
            ->withOption('SSL_VERIFYHOST', false)
            ->withOption('SSLKEY', $keyfile)
            ->withOption('SSLCERT', $certfile);
        $res = $curl->post();
        return in_array($res->status, [200, 201, 204]);
上一篇下一篇

猜你喜欢

热点阅读