4
狂飲我有這樣的笨以下的捲曲要求:轉換捲曲請求Laravel
$order = [
'index' => 'Value',
'index2' => 'Value2'
];
$this->curl->create($this->base_url.'order/');
$this->curl->http_login($creds['username'], $creds['password']);
$this->curl->ssl(TRUE, 2, 'certificates/certificate.pem');
$this->curl->option(CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
$this->curl->option(CURLOPT_FAILONERROR, FALSE);
$this->curl->post(json_encode($order));
$data = $this->curl->execute();
現在我需要發出的Laravel,在那裏我使用狂飲同樣的要求。我如何將它轉換爲Guzzle請求?
那麼SSL和證書呢? –
@HappyCoder Guzzle默認支持SSL請求,我假設你的base_url()返回一個以https:// –
@HappyCoder開頭的字符串,但是如果你使用自簽名證書,你可以只添加'verify'=>'證書/certificate.pem'或'verify'=> false以禁用SSL證書檢查 –