Closed haffoudhi closed 2 years ago
I found the solution by using addHeader.
$request = new Request($url, 'POST', '');
$request->setBody('test1=1&test2=2');
$request->addHeader('Content-Type', 'application/x-www-form-urlencoded');
You probably want to use FormBody
instead: https://github.com/amphp/http-client/blob/4daa9998c955aa9f14ae0096946a3d78a2f32490/examples/basic/4-forms.php#L19
Hey, I m new to http-client, I m trying POST request with post data. The request is POST but the data is empty.
here's the code:
here's test.php code:
Can you tell me how to build a post request correctly?