1
ワトソンは、次のコードがあります。ダイアログIBM - - カールPHP Laravel
curl -u "{username}":"{password}"
-X POST
--form [email protected]
--form name=templateName
"https://gateway.watsonplatform.net/dialog/api/v1/dialogs"
を私持っている:
$ch = curl_init();
$data['name'] = $this->post['name'].";type:form";
$data['file'] = $this->getCurlValue($this->post['file'], $this->post['nombre']);
curl_setopt($ch, CURLOPT_URL, $this->url.$this->metodo);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{$this->user}:{$this->pass}");
if(count($this->post) > 0){
//curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
$output = curl_exec($ch);
curl_close($ch);
json_decode($output);
ます$ this->ポストが...
$data = Request::only('name', 'file');
そして、私は答えとしてのみ得る:{}
私が逃しているものは? !
おかげでみんな...まず時間がカールしてアップロードファイルを送信しよう:
笑... PUTやDELETEメソッド必要があると述べ
愚かMSG。ターミナルでのカールはとても簡単です。また、 "@"、buuut、Curl Fileで "@"を非推奨としています... – carlos