Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send HTML code in an http POST request?

Tags:

html

http

post

php

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.

like image 327
RcoderNY Avatar asked Jan 19 '23 05:01

RcoderNY


1 Answers

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

like image 186
Matt Ball Avatar answered Jan 29 '23 01:01

Matt Ball