POST url enconding with cURL -
When I send a POST request with a CRL, in the POST field, if they contain strings with spaces, then enter url_encode Will strings or functions do this for me?
What's right?
CURLOPT_POSTFIELDS = & gt; 'Field = this is% 20is% 20good' or it
CURLOPT_POSTFIELDS = & gt; 'Field = this is good' I'm asking because I do not want it to encode the string twice and send false data in this way. Thanks
You have not specified this, but I think you Using PHP, is not it?
It should be urlencoded according to RFC 1738. You can use the function http_build_query (). I use, for example:
$ array = array ('field' = & gt; 'this is good'); Http_build_query ($ array, '', 'and'); You can also easily pass $ arrays in the form of options (such as CURLOPT_POSTFIELDS => $ arrays ), but this is a multipart / form- Will create the data request, rather than the "normal" application / x-www-form-urlencoded. PS: None of yours is correct, in fact :) You should encode the space according to RFC 1738, and not with% 20.
Comments
Post a Comment