Skip to content

Commit

Permalink
feat(curl): add the form request method.
Browse files Browse the repository at this point in the history
  • Loading branch information
helei112g committed Feb 3, 2020
1 parent 977a009 commit 8bd5bae
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Supports/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@ protected function postXML(string $url, string $xmlData, array $headers = [])
]);
}

protected function postForm(string $url, string $jsonData, array $headers = [])
/**
* 发送表单数据
* @param string $url
* @param array $formData
* @param array $headers
* @return array|mixed|ResponseInterface|string
*/
protected function postForm(string $url, array $formData, array $headers = [])
{
var_dump($jsonData);exit;
return $this->sendRequest('post', $url, [
'headers' => [
'content-type' => 'multipart/form-data',
],
'body' => $jsonData,
'headers' => $headers,
'multipart' => $formData,
'http_errors' => false,
]);
}
Expand Down

0 comments on commit 8bd5bae

Please sign in to comment.