2010-07-01 6 views
0

J'utilise CURL pour publier un tableau. Cela n'a pas fonctionné sans utiliser http_build_query(). Je mets une des lignes du tableau comme celui-ci:Problème de publication HTML en tant que variable dans Curl

$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"> 
'; 

puis faire 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; 

Et puis les choses se cassent. Quand j'ai enlevé le point-virgule, tout a bien fonctionné. Pourquoi aurais-je besoin d'échapper à des semi-colons ?!

+0

Je ne comprends pas la question - où avez-vous supprimez un point-virgule? – Till

+0

Probablement aurait dû faire une note: Je l'ai enlevé de "border-style: solide;" –

Répondre

Questions connexes