ci-dessous le code ne fonctionne pas sur un serveur, mais fonctionne très bien dans d'autres. Je reçois cette erreur:Curl ne fonctionne pas dans un serveur, mais OK dans tous les autres
Warning: simplexml_load_string(): Entity: line 1: parser error : Opening and ending tag mismatch: HR line 1 and body in testchecker.php on line 11
Warning: simplexml_load_string(): dden.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.20</h3></body> in testchecker.php on line 11
Warning: simplexml_load_string():^in testchecker.php on line 11
Warning: simplexml_load_string(): Entity: line 1: parser error : Opening and ending tag mismatch: HR line 1 and html in testchecker.php on line 11
Warning: simplexml_load_string(): Entity: line 1: parser error : Premature end of data in tag body line 1 in testchecker.php on line 11
Warning: simplexml_load_string(): Entity: line 1: parser error : Premature end of data in tag html line 1 in testchecker.php on line 11
Warning: Invalid argument supplied for foreach() in testchecker.php on line 12
<?php
set_time_limit(0);
$url="http://test";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$data = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($data);
foreach($xml->User as $child){
echo $child->Id."<br/>";
}
?>
Je ne comprends pas pourquoi cette erreur se produit, car dans les serveurs locaux et d'autres fonctionne correctement. Sur dreamhost, ce n'est pas. Quelqu'un peut-il m'aider dans ce domaine.
1) n'utilisez pas d'écrans d'impression si vous pouvez coller des informations textuelles dans la question et 2) indiquez dans votre code les lignes sur lesquelles les erreurs se plaignent. – fvu
mis à jour, s'il vous plaît voir –
1 - vérifier package php5-curl est installé – Fky