PHP - Simplexml Trouble
Hi guys!
I'm trying to parse an RSS feed using SimpleXML, but I'm having trouble lol Here's my code: $feed = file_get_contents("http://engadget.com/rss.xml"); $xml = new SimpleXMLElement($feed); echo $xml->rss->channel->item[0]->title; I'm expecting it to echo the title of the first item in the RSS feed, but when I run it, I just see a blank page. Tell me what I'm doing wrong! Similar TutorialsHey, Having some troubles extracting data from simpleXML object. var_dump outputs all the stuff correctly but when i try access data in the object, it just comes back empty. $rss = "/data/rss/"; $rss = file_get_contents($rss); // simplexml_load_file() fails $feed = new SimpleXMLElement($rss); foreach($feed->item as $news) { echo $news->title; // returns empty } echo $feed->item->title; // also is empty so var_dump($feed) outputs this, shortened version: object(SimpleXMLElement)#10 (2) { ["@attributes"]=> array(1) { ["version"]=> string(3) "2.0" } ["channel"]=> object(SimpleXMLElement)#11 (6) { ["title"]=> string(38) "Bradford Bulls Super League Rugby News" ["description"]=> string(75) "RSS Feed for the latest Bradford Bulls Super League rugby news and updates." ["link"]=> string(46) "http://www.superleaguefans.com/bradford-bulls/" ["language"]=> string(2) "en" ["pubDate"]=> string(26) "Sat, 03 Sep 13:42:39 +0100" ["item"]=> array(10){ [0]=> object(SimpleXMLElement)#12 (1) { ["title"]=> string(32) "Briggs and Walker in Bulls squad" } } } } so, $feed->item->title should return the ["title"] contents, but it doesn't, driving me crazy. what am i doing wrong? Any pointers will be much appreciated, thank you. so the code is <?php $xml1 = " <outer> <xml> <more_info> <user> <id>200</id> <name>CLUEL3SS</name> </user> <user> <id>201</id> <name>CLUEL3SS2</name> </user> </more_info> </xml> </outer> "; $cwb = simplexml_load_string($xml1); foreach($cwb->xml->more_info->user as $stats) { echo $stats->id."\n";} ?> output is Code: [Select] 200 201 Now, how can I echo the name under <id>201</id> since there is more than one? echo $stats->id."\n"; That echos both of the "ID" values, now how can I get it to only echo the second id 201 and the second name? Thanks Ok so I have a url that is an XML doc, it says at the top "This XML file does not appear to have any style information associated with it. The document tree is shown below." and it has info like this Code: [Select] <outer> <xml> <viewer> <user> <id>1245789</id> <name>CLueless</user> <business>none</business> </user> </viewer> </xml> </outer> How would I load the link and then assign everything to a variable like id, name and business I usually use something like this but Im trying to get learn simple xml $info = file_get_contents('url'); $id = explode('<id>', $info); $id = explode('</', $id[1]); $name = explode('<name>', $info); $name = explode('</', $name[1]); $biz = explode('<business>', $info); $biz = explode('</', $biz); Hi, I'm new to php and coding in general. I'm trying to parse xml from a remote device and access specific value data. Here is the xml: <?xml version="1.0" encoding="ISO-8859-1" ?> - <Device id="S10011" hb="1935"> <Group id="1" /> <Group id="2" /> <Group id="3" /> <Group id="4" /> <Group id="5" /> <Group id="6" /> <Group id="7" /> <Group id="8" /> - <Group id="9"> - <Probe id="99"> <Value>1.0</Value> </Probe> - <Probe id="1"> <Value>86.4</Value> </Probe> - <Probe id="2"> <Value>45.7</Value> </Probe> - <Probe id="3"> <Value>2.9</Value> </Probe> - <Probe id="4"> <Value>1.0</Value> </Probe> </Group> </Device> ----------------------- Here is my php code to read in the xml: <?php // Establish a port 80 connection $http = fsockopen("192.168.2.106",80); // Send a request to the server $req = "GET /xmldata HTTP/1.0\r\n"; $req .= "Host: 192.168.2.106\r\n"; $req .= "Connection: Close\r\n\r\n"; fputs($http, $req); // Output the request results while(!feof($http)) { $data .= fgets($http, 1024); } // Close the connection fclose($http); $xml = simplexml_load_string($data); print_r ($xml); ?> This yields the following data: SimpleXMLElement Object ( [@attributes] => Array ( [id] => S10011 [hb] => 117546 ) [Group] => Array ( => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1 ) => ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 2 ) => ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 3 ) => ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 4 ) => ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 5 ) => ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 6 ) => ) [6] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 7 ) => ) [7] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 8 ) => ) [8] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 9 ) [Probe] => Array ( => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 99 ) [Value] => 1.0 ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1 ) [Value] => 84.2 ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 2 ) [Value] => 44.1 ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 3 ) [Value] => 4.8 ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 4 ) [Value] => 1.0 ) ) ) ) ) I would like to display group 9 probe 1 value for example and I cannot get it to work. Any tips? Hello, Hope somebody can help me. I have an XML file that is generated by active directory that dumps everything required for a telephone directory. I currently present this using XSL but would like to move towards PHP. I have some rudimentary code and it's working fine but I'd like to be able to sort by various values, such as First Name or telephone number. My XML format looks like this: Code: [Select] <?xml version="1.0" encoding="UTF-8"?> <telephonelist> <employee> <firstname>Jimmy</firstname> <lastname>Jimmerson</lastname> <email>jimbo@companyxyz.com</email> <extensionnum>956</extensionnum> <jobtitle>Security Officer</jobtitle> <department>Security</department> </employee> <employee> <firstname>David</firstname> <lastname>Davidson</lastname> <email>David.Davidson@companyxyz.com</email> <extensionnum>968</extensionnum> <jobtitle>Manager</jobtitle> <department>Management</department> </employee> Any my current code looks like this: Code: [Select] <? $myStaffMembers = new SimpleXMLElement("includes/telephonelist.xml", null, true); echo <<<EOF <table width="95%" border="0"> <tr> <th><b>First Name</b></th> <th><b>Last Name</b></th> <th><b>Telephone Number</b></th> <th><b>Position</b></th> </tr> EOF; foreach($myStaffMembers as $myStaffMember) { echo " <tr> <td>{$myStaffMember->firstname}</td> <td>{$myStaffMember->lastname}</td> <td>{$myStaffMember->extensionnum}</td> <td>{$myStaffMember->jobtitle}</td> </tr>"; } ?> Appreciate any help anybody could give. Thanks, LJ Hello, I'm trying to read the data of a xml file with the help of simplexml. I'm having trouble reading subchilds. For example im trying to read the following xml: <root> <child> <subchild> <dataineed/> <dataineed/> <dtaineed/> <subchild> </child> </root> I'm using the following code: <?php $oLinkjes = new SimpleXMLElement('http://feedlink.php', 0, TRUE); $countcat = count($oLinkjes->subchild); echo $countcat; ?> It echo's the the result '0' which means that it does not successfully reads the subchild. Because of that i can't get the data i want. When i change subchild to child is does echo '1'. Anyone knows what I'm doing wrong here? I'm new to xml so there might be a easy fix to this. Hey there, I'm having a issue when I edit the XML file from a string here. Now the SimpleXML functions edit the nodes of the XML file perfectly and everything is done the way I want but upon returning the file to a string it keeps putting a XML content type at the top of the file, E.G: Before XML File Is Edited: Code: [Select] <settings> <!-- Port the server will listen on --> <port>7781</port> <!-- Maximum number of players the server will support (Max 32) --> <maxplayers>10</maxplayers> <!-- Maximum number of vehicles the server will support (Max 140) --> <maxvehicles>100</maxvehicles> <!-- Password clients will have to enter to connect --> <!-- password>None</password --> <!-- Add the server to the master list --> <listed>true</listed> <!-- The hostname players will see --> <hostname>IV:MP Server</hostname> <!-- The address the server will bind to --> <!-- hostaddress>127.0.0.1</hostaddress --> <!-- Toggles frequently called events which has impact on CPU usage --> <frequentevents>false</frequentevents> <!-- The scripts the server will load and run --> <script>cp.nut</script> <script>whisper.nut</script> <script>namecheck.nut</script> <script>runcode.nut</script> <!-- The modules the server will load and run --> <!-- For windows: --> <!-- module>Sample.dll</module --> <!-- For linux: --> <!-- module>Sample.so</module --> </settings> After XML File Is Edited Code: [Select] <?xml version=1.0?> <settings> <!-- Port the server will listen on --> <port>7781</port> <!-- Maximum number of players the server will support (Max 32) --> <maxplayers>10</maxplayers> <!-- Maximum number of vehicles the server will support (Max 140) --> <maxvehicles>100</maxvehicles> <!-- Password clients will have to enter to connect --> <!-- password>None</password --> <!-- Add the server to the master list --> <listed>true</listed> <!-- The hostname players will see --> <hostname>IV:MP Server</hostname> <!-- The address the server will bind to --> <!-- hostaddress>127.0.0.1</hostaddress --> <!-- Toggles frequently called events which has impact on CPU usage --> <frequentevents>false</frequentevents> <!-- The scripts the server will load and run --> <script>cp.nut</script> <script>whisper.nut</script> <script>namecheck.nut</script> <script>runcode.nut</script> <!-- The modules the server will load and run --> <!-- For windows: --> <!-- module>Sample.dll</module --> <!-- For linux: --> <!-- module>Sample.so</module --> </settings> Notice the addition to the header of the file "<?xml version=1.0?>". This is causing issues when the XML file is read by the server. Could anybody help me stop the SimpleXML editor from placing this in the header of the file? Thanks. Working with a now playing module for some music. My music player outputs this kind of XML (WHEN THE SONG IS PLAYING): <?xml version="1.0" encoding="utf-8" ?> - <Playing station="Station"> - <item type="MUS"> <Artist>Beatles</Artist> <SongTitle>Get Back</SongTitle> </item> </Playing> My music player outputs this kind of XML (WHEN THE SONG IS NOT PLAYING): <?xml version="1.0" encoding="utf-8" ?> - <Playing station="Station"> - <item type="END"> <Artist>MORE MUSIC SOON</Artist> <SongTitle /> </item> </Playing> Here's my PHP: Code: [Select] <?php $playing = simplexml_load_file("../playlist/nowplaying.xml"); foreach ($playing->item as $item) { printf("Now playing: %s\n", $item->SongTitle); printf("by %s\n", $item->Artist); } ?> I want to make my php document check the item TYPE. (item type="x"). If x equals "MUS", display the PHP like above. But if x displays "END", I want it to display something like "More music coming up". Right now, it displays "MORE MUSIC SOON by " I've attempted if statements to no avail, mainly because I'm not super familiar with them in PHP. Ideas? Greetings, I am trying to write XML using SimpleXML for a web service call. I was having success until the XML got a little more complicated. Here is the XML format where I am running into problems: Code: [Select] <Agent> <Person Last='Smith' First='John'> <Addresses /> <PhoneNumbers> <Phone Type='1' Number='888-555-1212'> </PhoneNumbers> </Person> </Agent> Here is my php: Code: [Select] $xmlOutput = new SimpleXMLElement('<?xml version="1.0"?><ReportRequest> </ReportRequest>'); $xmlOutput->addAttribute('CID','9200'); $xmlOutput->addAttribute('Diagram','1'); $xmlOutput->addAttribute('DueDate','2011-11-15'); $xmlOutput->addAttribute('NumPhotos','6'); $xmlOutput->addAttribute('InspectAfter',''); $xmlOutput->addAttribute('PolicyNumber','JTC0004425'); $reportType = $xmlOutput->addChild('ReportType'); $reportType->addAttribute('CPType','Commercial'); $reportType->addAttribute('SectionIDs',''); $reportType->addAttribute('Description',''); $reportType->addAttribute('ReportTypeID','123'); $locations = $xmlOutput->addChild('Locations')->addChild('Addresses')->addChild('Address'); $locations->addAttribute('Zip','91216'); $locations->addAttribute('City','Chatsworth'); $locations->addAttribute('Line1','123 Main St'); $locations->addAttribute('Line2','Suite 201'); $locations->addAttribute('State','CA'); $locations->addAttribute('Latitude',''); $locations->addAttribute('Longitude',''); $agent = $xmlOutput->addChild('Agent')->addChild('Person')->addChild('Addresses')->addChild('PhoneNumbers')->addChild('Phone'); $agent->addAttribute('Last','Smith'); $agent->addAttribute('Email',''); $agent->addAttribute('First','John'); $agent->addAttribute('Title',''); $agent->addAttribute('Type','1'); $agent->addAttribute('Number','888-555-1212'); $agent->addAttribute('TypeName','Office'); $agent->addAttribute('Extension',''); Header('Content-type: text/xml'); echo $xmlOutput->asXML(); Everything outputs as it should until the line that starts with $agent. I want the output to match the section above. I have tried several variations but I cannot seem to figure it out. I know the current PHP sample doesn't work. Help?? Thanks in advance, John Hello, I am sorry for this question in advance. I will try to explain it as detailed but, as short as possible so bare with me. I have a script that I did that parses an XML file and outputs the info in a table. The tables are created with each entry in XML file. Everything works great and as designed except for when there is no data. I know why it is doing this, I am just not sure how to approach fixing this. So here is what the data looks like where there is nothing and what the table shows. I am posting a screenshot of the XML file as I am not sure it will be empty if I post the link.
Hey guys I have the following code: Code: [Select] $xml = new SimpleXMLElement( 'http://steamcommunity.com/profiles/76561197963859775?xml=1' , NULL, TRUE ); print_r($xml);The problem here is that it doesnt echo everything correctly... It doesn't show avatarFull for me Code: [Select] impleXMLElement Object ( [steamID64] => 76561197961308838 [steamID] => SimpleXMLElement Object ( ) [onlineState] => in-game [stateMessage] => SimpleXMLElement Object ( ) [privacyState] => public [visibilityState] => 3 [avatarIcon] => SimpleXMLElement Object ( ) [avatarMedium] => SimpleXMLElement Object ( ) [avatarFull] => SimpleXMLElement Object ( ) That's what it shows, the avatarFull and a couple others are empty. How do I fix this? Thank you Hello and thanks in advance for any help. Overview: Im tyring to pull data from a XML api using simpleXML. I have ran into a problem with special characters and entities that simpleXML does not accept. IE " " Ive tried all the solutions i could find to no avail. SimpleXML gives me this error. parser error : Entity 'nbsp' not defined in Here is my code. Code: [Select] $feed = simplexml_load_file('URL TO API FEED'); $feed = html_entity_decode($feed); $feed = str_ireplace(array('<','>','&','\'','"'),array('<','>','&',''','"'),$feed); echo 'Game Title: ' .$feed->game. '</br>'; echo 'Ponts Earned: ' .$feed->gamerscore. '</br>'; echo 'Total Achievements: ' .$feed->totalachievements. '</br>'; foreach($feed->achievements->achievement as $ach) { $output = htmlentities($feed->title, ENT_QUOTES, "UTF-8"); echo $output; if( !empty($ach->unlockedartwork)){ echo '<img src=' .$ach->unlockedartwork. '></img></br>'; }else { echo '<img src=' .$ach->artwork. '></img></br>'; } } Here is the code im trying to retrieve. Code: [Select] <achievement id="40"> <title>Have Gun Will Travel </title> <artwork>http://</artwork> <gamerscore>20</gamerscore> <unlocked>true</unlocked> <unlockdate>7/4/2010</unlockdate> </achievement> I'm pretty new to php. But the below script should get news articles from google news rss. It is failing to load the simplexml and returns false. Any idea why? Code: [Select] $url = "http://news.google.com/news?geo=90210"; if ($xml = @simplexml_load_file($url)) { for ($i=0; $i<4; $i++) { $item= $xml->channel->item[$i]; $link= '<a href = "'.(string) $item->link.'", target= "_blank">'.(string) substr($item->title, 0, 50).'...</a><br />'; $news[]= $link; } } I am trying to retrieve an attribute from a node and I keep getting the error: Warning: main() [function.main]: Node no longer exists in /Users/dmonsewicz/Projects/noosemonsewicz/api_stuff/index.php on line 70 PHP Code Code: [Select] $xml = new SimpleXMLElement($result); $arr = $xml->tickets->attributes(); echo $arr['count']; XML Code: [Select] <tickets count="0" type="array"></tickets> Any ideas on what I may be doing wrong? Hi I am trying to use SimpleXML to populate some form fields from an XML file This is the SimpleXML code that I am using Code: [Select] <?php $vrm=strtoupper($_POST['veh_reg']); $file="https://www.cdlvis.com/lookup/getxml?username=username&mode=test&key=key&vrm=".$vrm.""; $dom=new DOMdocument(); $dom->load($file); $xml=simplexml_import_dom($dom); var_dump($xml); ?> The code for the display of the fields is: Code: [Select] <form name="vehicle_details" method="post" action="add_vehicle.php"> <table> <tr> <td>Registration Number:</td><td><input name="reg_num" type="text" value="<?php echo $xml->result[0]->vrm;?>" readonly="true" /></td></tr> <tr> <td>Make:</td><td><input name="make" type="text" value="<?php echo $xml->result[0]->make;?>" readonly="true" /></td></tr> <tr> <td>Model:</td><td><input name="model" type="text" value="<?php echo $xml->result[0]->model;?>" readonly="true" /></td></tr> <tr> <td>Date of Manufactu </td><td><input name="date_man" type="text" value="<?php echo $xml->result[0]->date_manufactured;?>" readonly="true" /></td></tr> <tr> <td>Date of First Registration:</td><td><input name="date_reg" type="text" value="<?php echo $xml->result[0]->first_registered;?>" readonly="true" /></td></tr> <tr> <td>Colour:</td><td><input name="colour" type="text" value="<?php echo $xml->result[0]->colour;?>" readonly="true" /></td></tr> <tr> <td>Body Style:</td><td><input name="body" type="text" value="<?php echo $xml->result[0]->body;?>" readonly="true" /></td></tr> <tr> <td>Number of Doors:</td><td><input name="doors" type="text" value="<?php echo $xml->result[0]->doors;?>" readonly="true" /></td></tr> <tr> <td>Engine Size:</td><td><input name="engine_size" type="text" value="<?php echo $xml->result[0]->engine_size;?>" readonly="true" /></td></tr> <tr> <td>Fuel Type:</td><td><input name="fuel_type" type="text" value="<?php echo $xml->result[0]->fuel;?>" readonly="true" /></td></tr> <tr> <td>Gearbox Type:</td><td><input name="gearbox" type="text" value="<?php echo $xml->result[0]->gearbox_type;?>" readonly="true" /></td></tr> <tr> <td>Previous Keepers:</td><td><input name="keepers" type="text" value="<?php echo $xml->result[0]->previous_keepers;?>" readonly="true" /></td></tr> <tr> <td>BHP:</td><td><input name="bhp" type="text" value="<?php echo $xml->result[0]->smmt_power_bhp;?>" readonly="true" /></td></tr> <tr> <td>Emissions:</td><td><input name="co2" type="text" value="<?php echo $xml->result[0]->smmt_co2;?>" readonly="true" /></td></tr> <tr> <td><input name="try_again" type="button" value="Try Again" /></td><td><input name="submit" type="submit" value="Next Stage" /></td></tr> </table> </form> In each of the fields on the form when I run the code is the following error Notice: Trying to get property of non-object in I have also done a var_dump of the xml and I get the following Code: [Select] object(SimpleXMLElement)#2 (15) { ["@attributes"]=> array(4) { ["id"]=> string(6) "344571" ["generated"]=> string(10) "1300307651" ["mode"]=> string(4) "test" ["account_id"]=> string(3) "165" } ["vrm"]=> string(7) "DC70XSC" ["make"]=> string(7) "RENAULT" ["model"]=> string(23) "SCENIC EXPRESSION 16V A" ["date_manufactured"]=> string(10) "2004-02-20" ["first_registered"]=> string(10) "2004-02-20" ["colour"]=> string(5) "GREEN" ["body"]=> string(3) "MPV" ["doors"]=> string(7) "5 DOORS" ["engine_size"]=> string(4) "1598" ["fuel"]=> string(6) "PETROL" ["gearbox_type"]=> string(19) "TIPTRONIC AUTOMATIC" ["previous_keepers"]=> string(1) "1" ["smmt_power_bhp"]=> string(5) "115.1" ["smmt_co2"]=> object(SimpleXMLElement)#3 (0) { } } What have I done wrong, any help will be much appreciated. Code: [Select] <?php $HitlistHeader = file_get_contents(url); $Hitlist = simplexml_load_string($HitlistHeader); foreach($Hitlist->xml->entry as $entry) { foreach($entry->target_user as $target) { $TargetID=$target->user_id; $TargetName=urldecode($target->mob_name); } foreach($entry->paid_user as $paiduser) { $PaidID=$paiduser->user_id; $PaidName=urldecode($paiduser->mob_name); } $Amount=$entry->amount; $TimeAgo=$entry->placed_time_ago; $Level=$entry->level; } for($cwb=1; $cwb!=count($entry); $cwb++) { echo $TargetID[$cwb]."\n"; echo $TargetName[$cwb]."\n"; echo $PaidID[$cwb]."\n"; echo $PaidName[$cwb]."\n"; echo $Amount[$cwb]."\n"; echo $TimeAgo[$cwb]."\n"; echo $Level[$cwb]."\n\n"; } sleep(100000); ?> it only echoes one character on only a few of the variables, I dont know what the problem could be.. Anyhelp to resolve this is appreciated Hi I want the icon of a digg user $apicall = 'http://services.digg.com/2.0/user.getInfo?usernames='.$username.'&type=xml'; $result = simplexml_load_file($apicall); print_r($result);() With that code I'll get this: Quote SimpleXMLElement Object ( [count] => 1 [users] => SimpleXMLElement Object ( [Ericquits] => SimpleXMLElement Object ( [username] => Ericquits [about] => SimpleXMLElement Object ( ) [user_id] => 20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e [name] => Eric Quit [icons] => SimpleXMLElement Object ( [item] => Array ( => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/c.4164547322.png [1] => http://cdn1.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/h.4164547322.png [2] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/m.4164547322.png [3] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/l.4164547322.png [4] => http://cdn1.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/p.4164547322.png [5] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/s.4164547322.png [6] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/r.4164547322.png ) ) [gender] => SimpleXMLElement Object ( ) [diggs] => 12 [comments] => 1 [followers] => 373 [location] => SimpleXMLElement Object ( ) [following] => 235 [submissions] => 9 [icon] => http://cdn3.diggstatic.com/user/20111010190724:bbd2c60f-17a6-4dc1-8a03-6fd96322752e/p.4164547322.png ) ) [title] => Info for users Ericquits [timestamp] => 1320350425 [uri] => http://services.digg.com/2.0/user.getInfo?usernames=Ericquits&type=json [cursor] => SimpleXMLElement Object ( ) [version] => 2.0 [authorized] => 0 [data] => users [method] => user.getInfo [user] => None So I want the icon the profile image of the user and I make this: print (string)$result->users->Ericquits->icon;() This works, but my question is if there is a solution to get the icon without Ericquits the username? Because if write it little I don't get the icon... I am trying to find out how to merge the FIPS part of this XML file into one php variable with SimpleXML. a sample xml file I'm trying to use is at http://server1.thezach.net/examplewarn.xml basically i want a variable with "001033,001077" in it (without the quotes) I'm new to PHP and this is my first time using this forum so please forgive me if I'm full of fail I get strings via simplexml with this code $xml = simplexml_load_file("test.xml"); foreach ($xml->title->case as $value){ $param1 = $value->param1; $param2 = $value->param2; Now I want to randomize the xml items (not in their original order); but I cannot use shuffle($value); because it does not consider $value as an array. How can I make a random order? |