Ich habe diesen Code XML aus einer Datei abgerufen werden (dies ist der gesamte Code von index.php):XML gibt manchmal false zurück?
<?php
libxml_use_internal_errors(true);
if(isset($_GET['user']))$user=htmlentities($_GET['user']);else $user="";
if(isset($_GET['designer']))$designer=htmlentities($_GET['designer']);else $designer="";
if(isset($_GET['id'])){$id = $_GET['id'];}else{if(isset($_SESSION['user'])){$id=$_SESSION['user'];}else{$id="";}}
libxml_use_internal_errors(true);
$form = '...form goes here...';
if(isset($_GET['user']) && isset($_GET['designer']) && isset($_GET['id'])){
if(empty($_GET['user']) or empty($_GET['designer']) or empty($_GET['id'])){
echo '<div class="error">Please fill out all fields!</div>';
echo $form;
} else if($_GET['id']<0 or !is_numeric($_GET['id']) or !is_numeric($_GET['user'])){
echo '<div class="error"><b>Invalid user ID:</b> Only numeric values allowed</div>';
echo $form;
} else {
$_SESSION['user'] = $_GET['id'];
$lop = curl_init($uopxls);
curl_setopt($lop, CURLOPT_RETURNTRANSFER, true);
curl_setopt($lop, CURLOPT_HTTPHEADER, array("Cookie: pdhUser=19982"));
$getMedItemsFile = curl_exec ($lop);
$xml = @simplexml_load_string(trim($getMedItemsFile), "SimpleXMLElement", LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_NOWARNING);
if($xml===FALSE){
echo '<div class="error"><b>Something weird happened.</b> Please reload the page or contact me for help. If reloading the page once doesn\'t help, keep trying to reload.</div>';
foreach(libxml_get_errors() as $error) {
echo "\t", $error->message;
}
} else {
$i=0;
foreach($xml->shopItems->item as $item){
if(strcasecmp($item['name'], 'Designed by '.$designer.'') == 0 && $item['brand']=='555'){
$i++;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.stardoll.com/en/ajax/reports/getDataForReport.php");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "reportedUserId=&customItemId=".$item['customItemId']."");
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Cookie: pdhUser=19982"));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_ENCODING, '');
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT ,0);
curl_setopt($curl, CURLOPT_TIMEOUT, 400);
$itemImage=curl_exec ($curl);
ob_flush();
$imgss=json_decode($itemImage,true);
curl_close ($curl);
?>
...here some content...
<?php
}
}
$foundItemsMsg="<p>This user has ".count($xml->shopItems->item)." item(s) in total and ".count($xml->shopItems->item['type']=='HAIR')." wigs in their beauty parlor. We found ".$i." wig(s) designed by <b>$designer</b>. <a href=\"/\">Clone other wigs ></a></p>";
echo $foundItemsMsg;
}
}
} else {
/* If $_GET's are not set */
echo $form;
}
?>
Manchmal Echos dieses „! Hat nicht funktioniert“, aber wenn ich die Seite funktioniert es neu zu laden (manchmal muss ich zweimal nachladen). Zu anderen Zeiten funktioniert es normal.
Kann mir jemand helfen herauszufinden, warum es das tut und wie man es daran hindert es wieder zu tun?
Thanks :)
Arbeit perfekt für mich .. – napster3world
'Cookie: admin = 1' Schön! –
@ ʰᵈˑEs ist eine lokale Website zum Testen, keine Sorge –