📜  带数据的 guzzle 发布请求 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:09.280000             🧑  作者: Mango

代码示例2
$response = $client->request('POST', 'http://www.example.com/files/post', [
    'multipart' => [
        [
            'name'     => 'file_name',
            'contents' => fopen('/path/to/file', 'r')
        ],
        [
            'name'     => 'csv_header',
            'contents' => 'First Name, Last Name, Username',
            'filename' => 'csv_header.csv'
        ]
    ]
]);