Closed cornjosh closed 5 years ago
By default data is sent as JSON, when you add asFormParams
data is sent as form params using the application/x-www-form-url-encoded
content type.
https://github.com/kitetail/zttp/blob/master/src/Zttp.php#L61-L64
Oh! So, what is the difference between these two ways? They also returned different results.
Zttp::post('http://example.com', [
'foo' => 'bar'
];
Zttp::post('http://example.com?foo=boo');
One is sending a JSON post body and the other is just sending query string parameters. The difference in response is up to the server you are talking to because the requests are different.
Closing as not an actual issue, just a question 👍
I tried to use Zttp to write a crawler. I found that using two different ways to initiate a POST request would have different results.
What is the difference between these two ways?