简体   繁体   中英

How to send HTML code in an http POST request?

I am an sending a HTTP POST request from a Google Web Toolkit app to a php script. The content-type is "application/x-www-form-urlencoded" right now so I can send variables to php and use $_POST[] in php but I don't think I can properly send HTML markup inside one of the variables.

Here's what I have: post_data = var1=true&var2=true$html="HTML MARKUP HERE"

When doing it this way barely any of the html comes through to php in the $_POST['html'] variable. What is the proper method to accomplish sending html markup in a POST variable. Thanks.

Percent-encode the query parameter. In JavaScript, you can use the encodeURIComponent function .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM