I have the following code:
$poststr = "param1=<html><head></head><body>test1 & test2</body></html>¶m2=abcd¶m3=eeee";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.mytest.com");
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $poststr);
curl_setopt($curl, CURLOPT_ENCODING, "");
$curlData = curl_exec($curl);
The post is not working and I'm guessing it has to do with the fact that the param1 has HTMl in it. But if I use htmlentities()
it doesn't help. I've tried using urlencode()
but still no go.