guzzle was upgraded to version 6 unknowingly. After the upgrade, the usage was different from the original 3.*. I was confused when I read the documentation. It took me a long time to find the usage from the documentation:
POST
<code><span>$response</span> = <span>$client</span>->request(<span>'POST'</span>, <span>'http://httpbin.org/post'</span>, [ <span>'form_params'</span> => [ <span>'field_name'</span> => <span>'abc'</span>, <span>'other_field'</span> => <span>'123'</span>, <span>'nested_field'</span> => [ <span>'nested'</span> => <span>'hello'</span> ] ] ]); <span>$result</span> = <span>$response</span>->getBody();</code>
GET
<code><span>$client</span><span>=</span><span>new</span> Client(); <span>$res</span><span>=</span><span>$client</span><span>-></span>request(<span>'GET'</span>, <span>$url</span><span>.</span><span>"?param1=1¶m2=9"</span>); <span>$result</span><span>=</span><span>$res</span><span>-></span>getBody();</code>
To be fair, it’s quite convenient.
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });The above introduces how to use guzzule 6 to send HTTP requests in PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.