I have this code to retrieve XML from a file:
<?php $lop = curl_init("http://www.stardoll.com/en/xml/getMeDollItems.php?external=1&id=11"); curl_setopt($lop, CURLOPT_RETURNTRANSFER, true); curl_setopt($lop, CURLOPT_HTTPHEADER, array("Cookie: admin=1")); $output = curl_exec ($lop); $xml=simplexml_load_string(trim($output)); if($xml===FALSE){ // didn't work echo "Did not work!"; } else { // it worked echo "Worked"; echo $xml->asXML(); } ?> Sometimes this echoes "Did not work!", but when I reload the page it works (sometimes I have to reload twice). Other times it works normally.
Can someone help me figure out why its doing this and how prevent it from doing it again?
Thanks :)
No comments:
Post a Comment