views:

22

answers:

1

I am using CURL to post an array. It didn't work without using http_build_query(). I set one of the rows in the array like this:

$postVars['key']='
<table style="border-style: solid;" width="850" align="center" bgcolor="#e9e9e9" border="3" bordercolor="#999999" cellpadding="0" cellspacing="0"> 
      <tbody><tr> 
           <td colspan="2" bgcolor="#d3d3d3" height="17">
';

and then do CURL:

$postURL = "https://post.xxx.org".$action;
$postData = http_build_query($postVars);
curl_setopt($ch, CURLOPT_URL, $postURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);

$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
echo $output;

And then things break. When I removed the semi-colon, everything worked great. Why would I need to escape semi-colons?!

A: 

You could use HTML entities

Phill Pafford