When using curl to send some data to the server without paying attention to details, you may get the following results, which Not the ideal result:
But if you use http_build_query($post_data) instead When $post_data submits data to this php script, you will get different results from the above. This is the ideal result:
As can be seen from the above example, when using curl and the parameter is data, when submitting data to the server, http The header will send content_type: application/x-www-form-urlencoded. This is the header sent by the browser when submitting a form on a normal web page. And multipart/form-data knows that this is the form used to upload files. Including the boundary delimiter will add many bytes. |