2016-09-19 1 views
0

Mon message curl ne renvoie pas de corps côté serveur. Comment puis-je rectifier cela?Corps du message non reçu

curl_setopt($ch, CURLOPT_URL,$cpUrl);// "ex:www.lalala/aa/" 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $varpost); // has string parameter 
curl_setopt($ch,CURLOPT_HTTPHEADER,array('VariableParams:'.$varpost)); 
info ("variables passed:",$varpost); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt($ch, CURLOPT_NOBODY, false); 
$output = curl_exec ($ch); // Execute 

Répondre

0

Il peut arriver que pour le serveur la requête soit redirigée vers une autre URL. Par exemple, en fonction de l'emplacement, certains sites Web le redirige vers un emplacement particulier. C'est pourquoi vous n'obtenez aucun corps car vous désactivez l'option de localisation suivante.

Essayez en l'activant.

curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);