SimpleXml array to string PHP - php

My PHP function is returning a SimpleXML array like this:
array(1) { [0]=> object(SimpleXMLElement)#6 (18) { ["#attributes"]=> array(6) { ["thumbnailUrl"]=> string(47) "users/908/721/swagg_ma_blue/thumbnail-12612.jpg" ["default"]=> string(1) "1" ["name"]=> string(5) "_copy" ["color"]=> string(8) "0xBB9977" ["mood"]=> string(1) "3" ["species"]=> string(4) "stud" } ["head"]=> object(SimpleXMLElement)#5 (1) { ["#attributes"]=> array(4) { ["url"]=> string(51) "http://assets.zwinky.com/assets/stud/heads/01/head1" ["c"]=> string(8) "0xF2B38A" ["c2"]=> string(8) "0xffffff" ["z"]=> string(5) "33000" } } ["face"]=> object(SimpleXMLElement)#7 (1) { ["#attributes"]=> array(5) { ["url"]=> string(51) "http://assets.zwinky.com/assets/stud/faces/01/stud1" ["c"]=> string(8) "0xFFFFFF" ["displayName"]=> string(5) "stud1" ["z"]=> string(5) "34000" ["id"]=> string(8) "20017217" } } ["belt"]=> array(2) { [0]=> object(SimpleXMLElement)#8 (1) { ["#attributes"]=> array(6) { ["url"]=> string(64) "http://assets.zwinky.com/assets/store/zwinky/stud/belts/01/Vblt1" ["c"]=> string(8) "0x000000" ["c2"]=> string(8) "0xFFFFFF" ["displayName"]=> string(30) "Tough Love Belt ketamine-dolly" ["z"]=> string(5) "20100" ["id"]=> string(8) "20098984" } } [1]=> object(SimpleXMLElement)#20 (1) { ["#attributes"]=> array(5) { ["url"]=> string(76) "http://ak.ugc.zwinky.com/zwinky/fds/creations/791/402/z-justin/1441479408229" ["isUgc"]=> string(4) "true" ["displayName"]=> string(9) "My Design" ["z"]=> string(5) "20100" ["id"]=> string(8) "20081015" } } } ["midsection"]=> object(SimpleXMLElement)#9 (1) { ["#attributes"]=> array(2) { ["url"]=> string(55) "http://assets.zwinky.com/assets/stud/midsections/01/ms1" ["z"]=> string(4) "9000" } } ["leg"]=> object(SimpleXMLElement)#10 (1) { ["#attributes"]=> array(2) { ["url"]=> string(50) "http://assets.zwinky.com/assets/stud/legs/01/legs1" ["z"]=> string(5) "10000" } } ["hair"]=> object(SimpleXMLElement)#11 (1) { ["#attributes"]=> array(6) { ["url"]=> string(62) "http://assets.zwinky.com/assets/store/zwinky/stud/hair/01/Zhr8" ["c"]=> string(8) "0xD0C0B0" ["c2"]=> string(8) "0x000000" ["displayName"]=> string(7) "spiky 3" ["z"]=> string(5) "37000" ["id"]=> string(8) "20013196" } } ["shirt"]=> object(SimpleXMLElement)#12 (1) { ["#attributes"]=> array(5) { ["url"]=> string(63) "http://assets.zwinky.com/assets/store/zwinky/stud/tops/01/Vtop2" ["c"]=> string(8) "0x212121" ["displayName"]=> string(8) "tank top" ["z"]=> string(5) "21000" ["id"]=> string(8) "20012196" } } ["jacket"]=> object(SimpleXMLElement)#13 (1) { ["#attributes"]=> array(5) { ["url"]=> string(76) "http://ak.ugc.zwinky.com/zwinky/fds/creations/113/681/b4d_b0yy/1452451820582" ["isUgc"]=> string(4) "true" ["displayName"]=> string(4) "asdf" ["z"]=> string(5) "30000" ["id"]=> string(8) "20080934" } } ["bottom"]=> object(SimpleXMLElement)#14 (1) { ["#attributes"]=> array(6) { ["url"]=> string(67) "http://assets.zwinky.com/assets/store/zwinky/stud/bottoms/01/MXbm14" ["c"]=> string(8) "0xD6D6D6" ["c2"]=> string(8) "0xFFFFFF" ["displayName"]=> string(15) "Steampunk Pants" ["z"]=> string(5) "20000" ["id"]=> string(8) "20039549" } } ["electronic"]=> object(SimpleXMLElement)#15 (1) { ["#attributes"]=> array(5) { ["url"]=> string(64) "http://assets.zwinky.com/assets/store/zwinky/stud/misc/01/SDmis1" ["c"]=> string(8) "0x3366FF" ["displayName"]=> string(12) "game player2" ["z"]=> string(5) "45000" ["id"]=> string(8) "20017518" } } ["hat"]=> object(SimpleXMLElement)#16 (1) { ["#attributes"]=> array(5) { ["url"]=> string(49) "http://assets.zwinky.com/assets/stud/hats/01/hat6" ["c"]=> string(3) "0x0" ["displayName"]=> string(13) "baseball cap2" ["z"]=> string(5) "40000" ["id"]=> string(8) "20017403" } } ["earrings"]=> object(SimpleXMLElement)#17 (1) { ["#attributes"]=> array(4) { ["url"]=> string(52) "http://assets.zwinky.com/assets/stud/earrings/01/er2" ["displayName"]=> string(10) "gold hoops" ["z"]=> string(5) "39000" ["id"]=> string(8) "20017442" } } ["bracelet"]=> object(SimpleXMLElement)#18 (1) { ["#attributes"]=> array(6) { ["url"]=> string(67) "http://assets.zwinky.com/assets/store/zwinky/stud/bracelets/01/Zbr1" ["c"]=> string(8) "0xFFFFFF" ["c2"]=> string(8) "0xB5B5B5" ["displayName"]=> string(13) "Leather Cuffs" ["z"]=> string(5) "13000" ["id"]=> string(8) "20013217" } } ["necklace"]=> object(SimpleXMLElement)#19 (1) { ["#attributes"]=> array(5) { ["url"]=> string(68) "http://assets.zwinky.com/assets/store/zwinky/stud/necklaces/01/SDnk1" ["c"]=> string(8) "0xffffff" ["displayName"]=> string(14) "Snoop Necklace" ["z"]=> string(5) "23000" ["id"]=> string(8) "20012554" } } ["facialhair"]=> object(SimpleXMLElement)#21 (1) { ["#attributes"]=> array(5) { ["url"]=> string(69) "http://assets.zwinky.com/assets/store/zwinky/stud/facialhair/01/Vfhr1" ["c"]=> string(8) "0xffffff" ["displayName"]=> string(16) "Evil Cupid beard" ["z"]=> string(5) "38000" ["id"]=> string(8) "20012194" } } ["food"]=> object(SimpleXMLElement)#22 (1) { ["#attributes"]=> array(4) { ["url"]=> string(64) "http://assets.zwinky.com/assets/store/zwinky/stud/misc/01/HWmis7" ["displayName"]=> string(11) "mug w/steam" ["z"]=> string(5) "47000" ["id"]=> string(8) "20017604" } } ["facialdecorations"]=> object(SimpleXMLElement)#23 (1) { ["#attributes"]=> array(5) { ["url"]=> string(88) "http://ak.ugc.zwinky.com/zwinky/fds/creations/235/447/simsea-gdh0thtb1tzch/1426865152881" ["isUgc"]=> string(4) "true" ["displayName"]=> string(9) "My Design" ["z"]=> string(5) "42500" ["id"]=> string(8) "20081020" } } } }
My function looks like the following:
function get_user_outfit(){
$zwinky_login = $this->curl_post_login();
if($zwinky_login){
$user_outfit = $this->curl_post('http://outfits.zwinky.com/users/' . $this->user_directories() . '/outfits.xml', false, $this->cookie, true, false);
$xml = simplexml_load_string($user_outfit);
$element = $xml->xpath("//outfit[#default=1]");
return $element;
}else{
return 'Could not login.';
}
}
and I can't find a way to translate this into a string.
I've been trying the following http://php.net/manual/en/simplexmlelement.asxml.php which wouldnt work.
Does anyone have a idea?

$xml->xpath(...) returns an array of nodes of the type SimpleXMLElement.
There's built in functions to convert it to a string, although you'll have to loop through the returned nodes.
E.g.
$nodes = $xml->path(...);
$str = '';
foreach($nodes as $node){
$str .= $node->asXML();
}
return $str;
If you want the value of a node, you can invoke the magic method __toString on the SimpleXMLElement object. E.g. echo $node['attribute']; or echo $xml->path('//outfit[#default=1]/some/name')[0];
Alternatively use PHP DOM which gives you a lot more control and flexibility.

Related

php Interpret xml file provided by NMAP

I have a xml file provided by NMAP 7.80, and I would like to interpret it using php version 7.4.3.
First I tried to use 'SimpleXMLElement', but I am not sure how to handle results.
$xml=simplexml_load_string($file, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS) or die("Error: Cannot create object");
Seems that #attributes is the main field, but I am not able to call it.
echo $xml1->attributes;
This is the output from the dump
object(SimpleXMLElement)#2 (6) { ["#attributes"]=> array(6) { ["scanner"]=> string(4) "nmap" ["args"]=> string(111) "nmap --script nmap-vulners/ -sV -oX /var/scripts/bash/security/log/UCFGSP.xml 192.168.1.1/32" ["start"]=> string(10) "1645692795" ["startstr"]=> string(24) "Thu Feb 24 05:53:15 2022" ["version"]=> string(4) "7.80" ["xmloutputversion"]=> string(4) "1.04" } ["scaninfo"]=> object(SimpleXMLElement)#8 (1) { ["#attributes"]=> array(4) { ["type"]=> string(3) "syn" ["protocol"]=> string(3) "tcp" ["numservices"]=> string(4) "1000" ["services"]=> string(3813) "1,3-4,6-7,9,13,17,(...)" } } ["verbose"]=> (I have omitted the rest...)
I also have tried to decode to json format. It works better, but the array structure is very hard to understand.
$xml = json_decode(json_encode((array) simplexml_load_string($file)), 1);
I can decode the data using e.g.
echo "type:".$xml['scaninfo']['#attributes']['type'] // output: type:syn
echo "scanner:".$xml["#attributes"]["scanner"] // output: scanner:nmap
Occurs there are too many fields, and I still creating several loops (foreach) in order to understand each multidimensional array loop.
Here is the dump:
array(6) { ["#attributes"]=> array(6) { ["scanner"]=> string(4) "nmap" ["args"]=> string(111) "nmap --script nmap-vulners/ -sV -oX /var/scripts/bash/security/log/UCFGSP.xml 192.168.1.1/32" ["start"]=> string(10) "1645692795" ["startstr"]=> string(24) "Thu Feb 24 05:53:15 2022" ["version"]=> string(4) "7.80" ["xmloutputversion"]=> string(4) "1.04" } ["scaninfo"]=> array(1) { ["#attributes"]=> array(4) { ["type"]=> string(3) "syn" ["protocol"]=> string(3) "tcp" ["numservices"]=> string(4) "1000" ["services"]=> string(3813) "1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389" } } ["verbose"]=> array(1) { ["#attributes"]=> array(1) { ["level"]=> string(1) "0" } } ["debugging"]=> array(1) { ["#attributes"]=> array(1) { ["level"]=> string(1) "0" } } ["host"]=> array(6) { ["#attributes"]=> array(2) { ["starttime"]=> string(10) "1645692796" ["endtime"]=> string(10) "1645692856" } ["status"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(2) "up" ["reason"]=> string(10) "echo-reply" ["reason_ttl"]=> string(3) "126" } } ["address"]=> array(1) { ["#attributes"]=> array(2) { ["addr"]=> string(15) "192.168.1.1" ["addrtype"]=> string(4) "ipv4" } } ["hostnames"]=> array(0) { } ["ports"]=> array(2) { ["extraports"]=> array(2) { ["#attributes"]=> array(2) { ["state"]=> string(6) "closed" ["count"]=> string(3) "983" } ["extrareasons"]=> array(1) { ["#attributes"]=> array(2) { ["reason"]=> string(6) "resets" ["count"]=> string(3) "983" } } } ["port"]=> array(17) { [0]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(2) "22" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(6) { ["name"]=> string(3) "ssh" ["product"]=> string(7) "OpenSSH" ["version"]=> string(15) "for_Windows_8.1" ["extrainfo"]=> string(12) "protocol 2.0" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(38) "cpe:/a:openbsd:openssh:for_windows_8.1" } } [1]=> array(4) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(2) "80" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(6) { ["name"]=> string(4) "http" ["product"]=> string(19) "Microsoft IIS httpd" ["version"]=> string(3) "8.0" ["ostype"]=> string(7) "Windows" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> array(2) { [0]=> string(24) "cpe:/a:microsoft:iis:8.0" [1]=> string(24) "cpe:/o:microsoft:windows" } } ["script"]=> array(2) { [0]=> array(2) { ["#attributes"]=> array(2) { ["id"]=> string(18) "http-server-header" ["output"]=> string(17) "Microsoft-IIS/8.0" } ["elem"]=> string(17) "Microsoft-IIS/8.0" } [1]=> array(2) { ["#attributes"]=> array(2) { ["id"]=> string(7) "vulners" ["output"]=> string(91) " cpe:/a:microsoft:iis:8.0: SMNTC-70937 7.6 https://vulners.com/symantec/SMNTC-70937" } ["table"]=> array(2) { ["#attributes"]=> array(1) { ["key"]=> string(24) "cpe:/a:microsoft:iis:8.0" } ["table"]=> array(1) { ["elem"]=> array(4) { [0]=> string(8) "symantec" [1]=> string(5) "false" [2]=> string(3) "7.6" [3]=> string(11) "SMNTC-70937" } } } } } } [2]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(3) "135" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(5) "msrpc" ["product"]=> string(21) "Microsoft Windows RPC" ["ostype"]=> string(7) "Windows" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(24) "cpe:/o:microsoft:windows" } } [3]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(3) "139" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(11) "netbios-ssn" ["product"]=> string(29) "Microsoft Windows netbios-ssn" ["ostype"]=> string(7) "Windows" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(24) "cpe:/o:microsoft:windows" } } [4]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(3) "445" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(12) "microsoft-ds" ["product"]=> string(52) "Microsoft Windows Server 2008 R2 - 2012 microsoft-ds" ["ostype"]=> string(29) "Windows Server 2008 R2 - 2012" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(24) "cpe:/o:microsoft:windows" } } [5]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(4) "1801" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(1) { ["#attributes"]=> array(3) { ["name"]=> string(4) "msmq" ["method"]=> string(5) "table" ["conf"]=> string(1) "3" } } } [6]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(4) "2103" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(5) "msrpc" ["product"]=> string(21) "Microsoft Windows RPC" ["ostype"]=> string(7) "Windows" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(24) "cpe:/o:microsoft:windows" } } [7]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(4) "2105" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(5) "msrpc" ["product"]=> string(21) "Microsoft Windows RPC" ["ostype"]=> string(7) "Windows" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(24) "cpe:/o:microsoft:windows" } } [8]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(4) "2107" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(5) "msrpc" ["product"]=> string(21) "Microsoft Windows RPC" ["ostype"]=> string(7) "Windows" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(24) "cpe:/o:microsoft:windows" } } [9]=> array(4) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(4) "3128" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(10) "http-proxy" ["product"]=> string(16) "Squid http proxy" ["version"]=> string(6) "3.5.28" ["method"]=> string(6) "probed" ["conf"]=> string(2) "10" } ["cpe"]=> string(31) "cpe:/a:squid-cache:squid:3.5.28" } ["script"]=> array(2) { [0]=> array(2) { ["#attributes"]=> array(2) { ["id"]=> string(18) "http-server-header" ["output"]=> string(12) "squid/3.5.28" } ["elem"]=> string(12) "squid/3.5.28" } [1]=> array(2) { ["#attributes"]=> array(2) { ["id"]=> string(7) "vulners" ["output"]=> string(2014) " cpe:/a:squid-cache:squid:3.5.28: MSF:ILITIES/UBUNTU-CVE-2019-12525/ 7.5 https://vulners.com/metasploit/MSF:ILITIES/UBUNTU-CVE-2019-12525/ *EXPLOIT* MSF:ILITIES/CENTOS_LINUX-CVE-2020-11945/ 7.5 https://vulners.com/metasploit/MSF:ILITIES/CENTOS_LINUX-CVE-2020-11945/ *EXPLOIT* CVE-2020-11945 7.5 https://vulners.com/cve/CVE-2020-11945 CVE-2019-12526 7.5 https://vulners.com/cve/CVE-2019-12526 CVE-2019-12525 7.5 https://vulners.com/cve/CVE-2019-12525 CVE-2019-12519 7.5 https://vulners.com/cve/CVE-2019-12519 CVE-2020-24606 7.1 https://vulners.com/cve/CVE-2020-24606 CVE-2020-15049 6.5 https://vulners.com/cve/CVE-2020-15049 CVE-2019-12523 6.4 https://vulners.com/cve/CVE-2019-12523 CVE-2019-18677 5.8 https://vulners.com/cve/CVE-2019-18677 MSF:ILITIES/UBUNTU-CVE-2021-31807/ 5.0 https://vulners.com/metasploit/MSF:ILITIES/UBUNTU-CVE-2021-31807/ *EXPLOIT* CVE-2021-28651 5.0 https://vulners.com/cve/CVE-2021-28651 CVE-2020-25097 5.0 https://vulners.com/cve/CVE-2020-25097 CVE-2020-14058 5.0 https://vulners.com/cve/CVE-2020-14058 CVE-2019-18679 5.0 https://vulners.com/cve/CVE-2019-18679 CVE-2019-18678 5.0 https://vulners.com/cve/CVE-2019-18678 CVE-2019-18676 5.0 https://vulners.com/cve/CVE-2019-18676 CVE-2019-12529 4.3 https://vulners.com/cve/CVE-2019-12529 CVE-2019-12521 4.3 https://vulners.com/cve/CVE-2019-12521 CVE-2021-31807 4.0 https://vulners.com/cve/CVE-2021-31807 CVE-2021-28652 4.0 https://vulners.com/cve/CVE-2021-28652 MSF:ILITIES/UBUNTU-CVE-2021-28651/ 0.0 https://vulners.com/metasploit/MSF:ILITIES/UBUNTU-CVE-2021-28651/ *EXPLOIT* MSF:ILITIES/SUSE-CVE-2021-28652/ 0.0 https://vulners.com/metasploit/MSF:ILITIES/SUSE-CVE-2021-28652/ *EXPLOIT* MSF:ILITIES/SUSE-CVE-2021-28651/ 0.0 https://vulners.com/metasploit/MSF:ILITIES/SUSE-CVE-2021-28651/ *EXPLOIT* MSF:ILITIES/DEBIAN-CVE-2021-31807/ 0.0 https://vulners.com/metasploit/MSF:ILITIES/DEBIAN-CVE-2021-31807/ *EXPLOIT*" } ["table"]=> array(2) { ["#attributes"]=> array(1) { ["key"]=> string(31) "cpe:/a:squid-cache:squid:3.5.28" } ["table"]=> array(25) { [0]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "7.5" [3]=> string(34) "MSF:ILITIES/UBUNTU-CVE-2019-12525/" } } [1]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "7.5" [3]=> string(40) "MSF:ILITIES/CENTOS_LINUX-CVE-2020-11945/" } } [2]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "7.5" [3]=> string(14) "CVE-2020-11945" } } [3]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "7.5" [3]=> string(14) "CVE-2019-12526" } } [4]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "7.5" [3]=> string(14) "CVE-2019-12525" } } [5]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "7.5" [3]=> string(14) "CVE-2019-12519" } } [6]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "7.1" [3]=> string(14) "CVE-2020-24606" } } [7]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "6.5" [3]=> string(14) "CVE-2020-15049" } } [8]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "6.4" [3]=> string(14) "CVE-2019-12523" } } [9]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.8" [3]=> string(14) "CVE-2019-18677" } } [10]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "5.0" [3]=> string(34) "MSF:ILITIES/UBUNTU-CVE-2021-31807/" } } [11]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.0" [3]=> string(14) "CVE-2021-28651" } } [12]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.0" [3]=> string(14) "CVE-2020-25097" } } [13]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.0" [3]=> string(14) "CVE-2020-14058" } } [14]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.0" [3]=> string(14) "CVE-2019-18679" } } [15]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.0" [3]=> string(14) "CVE-2019-18678" } } [16]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "5.0" [3]=> string(14) "CVE-2019-18676" } } [17]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "4.3" [3]=> string(14) "CVE-2019-12529" } } [18]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "4.3" [3]=> string(14) "CVE-2019-12521" } } [19]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "4.0" [3]=> string(14) "CVE-2021-31807" } } [20]=> array(1) { ["elem"]=> array(4) { [0]=> string(3) "cve" [1]=> string(5) "false" [2]=> string(3) "4.0" [3]=> string(14) "CVE-2021-28652" } } [21]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "0.0" [3]=> string(34) "MSF:ILITIES/UBUNTU-CVE-2021-28651/" } } [22]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "0.0" [3]=> string(32) "MSF:ILITIES/SUSE-CVE-2021-28652/" } } [23]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "0.0" [3]=> string(32) "MSF:ILITIES/SUSE-CVE-2021-28651/" } } [24]=> array(1) { ["elem"]=> array(4) { [0]=> string(10) "metasploit" [1]=> string(4) "true" [2]=> string(3) "0.0" [3]=> string(34) "MSF:ILITIES/DEBIAN-CVE-2021-31807/" } } } } } } } [10]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(4) "3389" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(1) { ["#attributes"]=> array(4) { ["name"]=> string(13) "ms-wbt-server" ["tunnel"]=> string(3) "ssl" ["method"]=> string(5) "table" ["conf"]=> string(1) "3" } } } [11]=> array(3) { ["#attributes"]=> array(2) { ["protocol"]=> string(3) "tcp" ["portid"]=> string(5) "49152" } ["state"]=> array(1) { ["#attributes"]=> array(3) { ["state"]=> string(4) "open" ["reason"]=> string(7) "syn-ack" ["reason_ttl"]=> string(3) "126" } } ["service"]=> array(2) { ["#attributes"]=> array(5) { ["name"]=> string(5) "msrpc" ["product"]=> (...)
My question is : Based on xml file, should I keep working with json decode (arrays), or give more attention to SimpleXMLElement?
I believe json is easier, but is there a way to give a structural output from the entire array?
e.g.
array(
array(
'#attributes' => array(
array(
'scanner' => 'nmap',
'args' => 'nmap --script nmap-vulners...',
'start' => '1645692795',
(etc...)
Here is a sample of the XML format:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nmaprun>
<?xml-stylesheet href="file:///usr/.../nmap.xsl" type="text/xsl"?>
<!-- Nmap 7.80 scan initiated Thu Feb 24 05:53:15 2022 as: nmap --script nmap-vulners/ -sV -oX /var/scripts/bash/security/log/UCFGSP.xml 192.168.1.1/32 -->
<nmaprun scanner="nmap" args="nmap --script nmap-vulners/ -sV -oX /var/scripts/bash/security/log/UCFGSP.xml 192.168.1.1/32" start="1645692795" startstr="Thu Feb 24 05:53:15 2022" version="7.80" xmloutputversion="1.04">
<scaninfo type="syn" protocol="tcp" numservices="1000" services="1,3-4,6-7,9,13,(...)"/>
<verbose level="0"/>
<debugging level="0"/>
<host starttime="1645692796" endtime="1645692856"><status state="up" reason="echo-reply" reason_ttl="126"/>
<address addr="192.168.1.1" addrtype="ipv4"/>
<hostnames>
</hostnames>
<ports><extraports state="closed" count="983">
<extrareasons reason="resets" count="983"/>
</extraports>
<port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="126"/><service name="ssh" product="OpenSSH" version="for_Windows_8.1" extrainfo="protocol 2.0" method="probed" conf="10"><cpe>cpe:/a:openbsd:openssh:for_windows_8.1</cpe></service></port>
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="126"/><service name="http" product="Microsoft IIS httpd" version="8.0" ostype="Windows" method="probed" conf="10"><cpe>cpe:/a:microsoft:iis:8.0</cpe><cpe>cpe:/o:microsoft:windows</cpe></service><script id="http-server-header" output="Microsoft-IIS/8.0"><elem>Microsoft-IIS/8.0</elem>
</script><script id="vulners" output="
cpe:/a:microsoft:iis:8.0:
SMNTC-70937 7.6 https://vulners.com/symantec/SMNTC-70937"><table key="cpe:/a:microsoft:iis:8.0">
<table>
<elem key="type">symantec</elem>
<elem key="is_exploit">false</elem>
<elem key="cvss">7.6</elem>
<elem key="id">SMNTC-70937</elem>
</table>
</table>
</script></port>
<port>
<table key="cpe:/a:squid-cache:squid:3.5.28">
<elem key="type">metasploit</elem>
<elem key="is_exploit">true</elem>
<elem key="cvss">7.5</elem>
<elem key="id">MSF:ILITIES/UBUNTU-CVE-2019-12525/</elem>
</table>
</port>
</ports>
</host>
</nmaprun>
A few things to get out of the habit of:
Don't bother with LIBXML_NOCDATA; it's a formatting flag for when you're outputting XML, and generally makes no difference to reading it.
Don't try to encode XML as JSON, or a PHP array; you'll just get in a muddle.
Don't trust the output of var_dump and friends for these objects, because they have rather a lot of "magic" that isn't displayed well.
What you should do is:
Have a look at the examples in the PHP manual. The simplest explanation is that you use ->name to access child elements (tags), and ['name'] to access attributes.
Cast values using (string)$foo when you want them as a plain string rather than an object to navigate further.
So in your case, to get the "type" in the "scaninfo", you simply write this:
$type = (string)$xml->scaninfo['type'];
Or to get all the "portids", you would write this:
$portids = [];
foreach ( $xml->host->ports->port as $port ) {
$portids[] = (string)$port['portid'];
}
I got it working with this syntax:
$xml=simplexml_load_string($file, 'SimpleXMLElement', LIBXML_NOBLANKS) or die("Error: Cannot create object");
echo $xml->scaninfo->attributes()->protocol;
Thank you all.

PHP: Convert Google Sheets result object to simple array

I've google sheet with this data:
I'm pulling it from google drive with simple code:
$ranges = [
'Price_1'
];
$params = array(
'ranges' => $ranges
);
$response = $service->spreadsheets_values->batchGet($spreadsheetId, $params);
The response is a complicated object:
object(Google_Service_Sheets_BatchGetValuesResponse)#58 (8) { ["collection_key":protected]=> string(11) "valueRanges" ["spreadsheetId"]=> string(44) "1BQpKLuvlaVeGqIqoGUOynF9IZ5C3zK6gagZiRJO1UEU" ["valueRangesType":protected]=> string(32) "Google_Service_Sheets_ValueRange" ["valueRangesDataType":protected]=> string(5) "array" ["internal_gapi_mappings":protected]=> array(0) { } ["modelData":protected]=> array(0) { } ["processed":protected]=> array(0) { } ["valueRanges"]=> array(1) { [0]=> object(Google_Service_Sheets_ValueRange)#67 (7) { ["collection_key":protected]=> string(6) "values" ["majorDimension"]=> string(4) "ROWS" ["range"]=> string(14) "Price_1!E2:E74" ["values"]=> array(65) { [0]=> array(1) { [0]=> string(2) "28" } [1]=> array(1) { [0]=> string(2) "14" } [2]=> array(1) { [0]=> string(1) "0" } [3]=> array(0) { } [4]=> array(1) { [0]=> string(2) "55" } [5]=> array(1) { [0]=> string(2) "28" } [6]=> array(1) { [0]=> string(1) "0" } [7]=> array(0) { } [8]=> array(0) { } [9]=> array(0) { } [10]=> array(0) { } [11]=> array(0) { } [12]=> array(0) { } [13]=> array(0) { } [14]=> array(0) { } [15]=> array(0) { } [16]=> array(0) { } [17]=> array(0) { } [18]=> array(0) { } [19]=> array(0) { } [20]=> array(1) { [0]=> string(2) "59" } [21]=> array(1) { [0]=> string(2) "49" } [22]=> array(0) { } [23]=> array(1) { [0]=> string(2) "38" } [24]=> array(1) { [0]=> string(2) "38" } [25]=> array(0) { } [26]=> array(1) { [0]=> string(2) "37" } [27]=> array(1) { [0]=> string(2) "25" } [28]=> array(1) { [0]=> string(1) "0" } [29]=> array(0) { } [30]=> array(1) { [0]=> string(2) "79" } [31]=> array(1) { [0]=> string(2) "99" } [32]=> array(0) { } [33]=> array(1) { [0]=> string(2) "75" } [34]=> array(1) { [0]=> string(2) "99" } [35]=> array(0) { } [36]=> array(1) { [0]=> string(2) "79" } [37]=> array(1) { [0]=> string(2) "99" } [38]=> array(0) { } [39]=> array(1) { [0]=> string(3) "160" } [40]=> array(1) { [0]=> string(3) "190" } [41]=> array(0) { } [42]=> array(0) { } [43]=> array(0) { } [44]=> array(0) { } [45]=> array(0) { } [46]=> array(0) { } [47]=> array(0) { } [48]=> array(0) { } [49]=> array(0) { } [50]=> array(0) { } [51]=> array(0) { } [52]=> array(1) { [0]=> string(2) "33" } [53]=> array(0) { } [54]=> array(1) { [0]=> string(2) "59" } [55]=> array(1) { [0]=> string(2) "34" } [56]=> array(1) { [0]=> string(1) "0" } [57]=> array(0) { } [58]=> array(1) { [0]=> string(2) "29" } [59]=> array(1) { [0]=> string(2) "14" } [60]=> array(1) { [0]=> string(1) "0" } [61]=> array(0) { } [62]=> array(1) { [0]=> string(2) "37" } [63]=> array(1) { [0]=> string(2) "25" } [64]=> array(1) { [0]=> string(1) "0" } } ["internal_gapi_mappings":protected]=> array(0) { } ["modelData":protected]=> array(0) { } ["processed":protected]=> array(0) { } } } }
and var_dump($response->getValueRanges()[0]['values']); gives this result:
array(74) { [0]=> array(5) { [0]=> string(2) "ID" [1]=> string(10) "Ticket for" [2]=> string(9) "Excursion" [3]=> string(8) "Duration" [4]=> string(14) "Price (Brutto)" } [1]=> array(5) { [0]=> string(3) "01A" [1]=> string(13) "adult ( 12+ )" [2]=> string(9) "Catamaran" [3]=> string(2) "2h" [4]=> string(2) "28" } [2]=> array(5) { [0]=> string(3) "01B" [1]=> string(18) "child ( age 5-11 )" [2]=> string(9) "Catamaran" [3]=> string(2) "2h" [4]=> string(2) "14" } [3]=> array(5) { [0]=> string(3) "01C" [1]=> string(18) "toodler ( age 0-4)" [2]=> string(9) "Catamaran" [3]=> string(2) "2h" [4]=> string(1) "0" } [4]=> array(0) { } [5]=> array(5) { [0]=> string(3) "02A" [1]=> string(13) "adult, age 8+" [2]=> string(17) "Luxurt yacht trip" [3]=> string(2) "3h" [4]=> string(2) "55" } [6]=> array(5) { [0]=> string(3) "02B" [1]=> string(14) "child, age 3-7" [2]=> string(17) "Luxurt yacht trip" [3]=> string(2) "3h" [4]=> string(2) "28" } [7]=> array(5) { [0]=> string(3) "02C" [1]=> string(16) "toodler, age 0-2" [2]=> string(17) "Luxurt yacht trip" [3]=> string(2) "3h" [4]=> string(1) "0" } [8]=> array(0) { } [9]=> array(3) { [0]=> string(3) "03A" [1]=> string(0) "" [2]=> string(8) "Sailboat" } [10]=> array(3) { [0]=> string(3) "03B" [1]=> string(0) "" [2]=> string(8) "Sailboat" } [11]=> array(3) { [0]=> string(3) "03C" [1]=> string(0) "" [2]=> string(8) "Sailboat" } [12]=> array(0) { } [13]=> array(3) { [0]=> string(3) "04A" [1]=> string(0) "" [2]=> string(9) "Submarine" } [14]=> array(3) { [0]=> string(3) "04B" [1]=> string(0) "" [2]=> string(9) "Submarine" } [15]=> array(3) { [0]=> string(3) "04C" [1]=> string(0) "" [2]=> string(9) "Submarine" } [16]=> array(0) { } [17]=> array(3) { [0]=> string(3) "05A" [1]=> string(0) "" [2]=> string(13) "JetSki safari" } [18]=> array(3) { [0]=> string(3) "05B" [1]=> string(0) "" [2]=> string(13) "JetSki safari" } [19]=> array(3) { [0]=> string(3) "05C" [1]=> string(0) "" [2]=> string(13) "JetSki safari" } [20]=> array(0) { } [21]=> array(5) { [0]=> string(3) "06A" [1]=> string(9) "fisherman" [2]=> string(7) "Fishing" [3]=> string(2) "4h" [4]=> string(2) "59" } [22]=> array(5) { [0]=> string(3) "06B" [1]=> string(9) "spectator" [2]=> string(7) "Fishing" [3]=> string(2) "4h" [4]=> string(2) "49" } [23]=> array(0) { } [24]=> array(5) { [0]=> string(3) "07A" [1]=> string(5) "adult" [2]=> string(12) "Parascending" [3]=> string(5) "30min" [4]=> string(2) "38" } [25]=> array(5) { [0]=> string(3) "07B" [1]=> string(13) "child, age 6+" [2]=> string(12) "Parascending" [3]=> string(5) "30min" [4]=> string(2) "38" } [26]=> array(0) { } [27]=> array(5) { [0]=> string(3) "08A" [1]=> string(14) "adult, age 12+" [2]=> string(9) "Siam Park" [3]=> string(0) "" [4]=> string(2) "37" } [28]=> array(5) { [0]=> string(3) "08B" [1]=> string(15) "child, age 3-11" [2]=> string(9) "Siam Park" [3]=> string(0) "" [4]=> string(2) "25" } [29]=> array(5) { [0]=> string(3) "08C" [1]=> string(16) "toodler, age 0-1" [2]=> string(9) "Siam Park" [3]=> string(0) "" [4]=> string(1) "0" } [30]=> array(0) { } [31]=> array(5) { [0]=> string(3) "09A" [1]=> string(17) "flight from 800m." [2]=> string(18) "Paragliding tandem" [3]=> string(5) "15min" [4]=> string(2) "79" } [32]=> array(5) { [0]=> string(3) "09B" [1]=> string(18) "flight from 1000m." [2]=> string(18) "Paragliding tandem" [3]=> string(5) "25min" [4]=> string(2) "99" } [33]=> array(0) { } [34]=> array(5) { [0]=> string(3) "10A" [1]=> string(21) "Single (for 1 person)" [2]=> string(27) "Quad safari Forest explorer" [3]=> string(2) "3h" [4]=> string(2) "75" } [35]=> array(5) { [0]=> string(3) "10B" [1]=> string(22) "Double (for 2 persons)" [2]=> string(27) "Quad safari Forest explorer" [3]=> string(2) "3h" [4]=> string(2) "99" } [36]=> array(0) { } [37]=> array(5) { [0]=> string(3) "11A" [1]=> string(21) "Single (for 1 person)" [2]=> string(24) "Quad Safari - Teide tour" [3]=> string(2) "4h" [4]=> string(2) "79" } [38]=> array(5) { [0]=> string(3) "11B" [1]=> string(22) "Double (for 2 persons)" [2]=> string(24) "Quad Safari - Teide tour" [3]=> string(2) "4h" [4]=> string(2) "99" } [39]=> array(0) { } [40]=> array(5) { [0]=> string(3) "12A" [1]=> string(21) "Single (for 1 person)" [2]=> string(15) "Buggy adventure" [3]=> string(2) "3h" [4]=> string(3) "160" } [41]=> array(5) { [0]=> string(3) "12B" [1]=> string(22) "Double (for 2 persons)" [2]=> string(15) "Buggy adventure" [3]=> string(2) "3h" [4]=> string(3) "190" } [42]=> array(0) { } [43]=> array(3) { [0]=> string(3) "13A" [1]=> string(0) "" [2]=> string(8) "Trekking" } [44]=> array(3) { [0]=> string(3) "13B" [1]=> string(0) "" [2]=> string(8) "Trekking" } [45]=> array(3) { [0]=> string(3) "13C" [1]=> string(0) "" [2]=> string(8) "Trekking" } [46]=> array(0) { } [47]=> array(3) { [0]=> string(3) "14A" [1]=> string(0) "" [2]=> string(7) "Karting" } [48]=> array(3) { [0]=> string(3) "14B" [1]=> string(0) "" [2]=> string(7) "Karting" } [49]=> array(3) { [0]=> string(3) "14C" [1]=> string(0) "" [2]=> string(7) "Karting" } [50]=> array(0) { } [51]=> array(3) { [0]=> string(3) "15A" [1]=> string(0) "" [2]=> string(11) "Jungle park" } [52]=> array(3) { [0]=> string(3) "15B" [1]=> string(0) "" [2]=> string(11) "Jungle park" } [53]=> array(5) { [0]=> string(3) "15C" [1]=> string(0) "" [2]=> string(11) "Jungle park" [3]=> string(0) "" [4]=> string(2) "33" } [54]=> array(0) { } [55]=> array(5) { [0]=> string(3) "16A" [1]=> string(14) "adult, age 12+" [2]=> string(16) "La Gomera island" [3]=> string(12) "7:40 - 18:00" [4]=> string(2) "59" } [56]=> array(5) { [0]=> string(3) "16B" [1]=> string(15) "child, age 2-11" [2]=> string(16) "La Gomera island" [3]=> string(12) "7:40 - 18:00" [4]=> string(2) "34" } [57]=> array(5) { [0]=> string(3) "16C" [1]=> string(16) "toodler, age 0-1" [2]=> string(16) "La Gomera island" [3]=> string(12) "7:40 - 18:00" [4]=> string(1) "0" } [58]=> array(0) { } [59]=> array(5) { [0]=> string(3) "17A" [1]=> string(14) "adult, age 12+" [2]=> string(31) "Santa Cruz/ La Laguna/ Taganana" [3]=> string(1) "?" [4]=> string(2) "29" } [60]=> array(5) { [0]=> string(3) "17B" [1]=> string(15) "child, age 2-11" [2]=> string(31) "Santa Cruz/ La Laguna/ Taganana" [3]=> string(1) "?" [4]=> string(2) "14" } [61]=> array(5) { [0]=> string(3) "17C" [1]=> string(16) "toodler, age 0-1" [2]=> string(31) "Santa Cruz/ La Laguna/ Taganana" [3]=> string(1) "?" [4]=> string(1) "0" } [62]=> array(0) { } [63]=> array(5) { [0]=> string(3) "18A" [1]=> string(14) "adult, age 12+" [2]=> string(11) "Loro parque" [3]=> string(12) "8:30 - 18:45" [4]=> string(2) "37" } [64]=> array(5) { [0]=> string(3) "18B" [1]=> string(15) "child, age 6-11" [2]=> string(11) "Loro parque" [3]=> string(0) "" [4]=> string(2) "25" } [65]=> array(5) { [0]=> string(3) "18C" [1]=> string(16) "toodler, age 0-1" [2]=> string(11) "Loro parque" [3]=> string(0) "" [4]=> string(1) "0" } [66]=> array(0) { } [67]=> array(3) { [0]=> string(3) "19A" [1]=> string(0) "" [2]=> string(9) "Antologia" } [68]=> array(3) { [0]=> string(3) "19B" [1]=> string(0) "" [2]=> string(9) "Antologia" } [69]=> array(3) { [0]=> string(3) "19C" [1]=> string(0) "" [2]=> string(9) "Antologia" } [70]=> array(0) { } [71]=> array(3) { [0]=> string(3) "20A" [1]=> string(0) "" [2]=> string(13) "Medieval show" } [72]=> array(3) { [0]=> string(3) "20B" [1]=> string(0) "" [2]=> string(13) "Medieval show" } [73]=> array(3) { [0]=> string(3) "20C" [1]=> string(0) "" [2]=> string(13) "Medieval show" } }
And:
for($i = 1; $i < 5; $i++) {
print_r ($response->getValueRanges()[0]['values'][$i]);
}
Gives: Array ( [0] => 01A [1] => adult ( 12+ ) [2] => Catamaran [3] => 2h [4] => 28 ) Array ( [0] => 01B [1] => child ( age 5-11 ) [2] => Catamaran [3] => 2h [4] => 14 ) Array ( [0] => 01C [1] => toodler ( age 0-4) [2] => Catamaran [3] => 2h [4] => 0 ) Array ( )
In result I need a simple array, which will hold a key[row id], the ID from from ID row and price from last row, somethig like this: $result[$i] = unique_id=1, ID=01A, price=28
How it could be achieved?
So after getting the data for google sheet with:
$arr = $response->getValueRanges()[0]['values'];
You can use this simple for loop to get the data as you need:
// notice start from 1 to avoid the headers
for($i = 1; $i < count($arr); $i++) {
$res[$i] = array("unique_id" => $i, "ID" => $arr[$i][0], "price" => $arr[$i][4]);
}
Now $res will contain you structure.

Php getting data out of an array

I have a massive array that i can't get data out of. I can only get data out of the first set of items.
I need to get to
["USFICO"]=>
array(3) {
["FICOScore"]=>
string(5) "00650"
out of it. But i can only get the top portion to work w/ $tester = $array['EfxReport']['#attributes']['reportId']; outputs to string(22) "USConsumerCreditReport" as expected.
how can i get the FICO score out of this array.
Here is the array.
array(1) {
["EfxReport"]=>
array(3) {
["#attributes"]=>
array(2) {
["requestNumber"]=>
string(1) "1"
["reportId"]=>
string(22) "USConsumerCreditReport"
}
["USDecisionPowerExpressReports"]=>
array(1) {
["USDecisionPowerExpressReport"]=>
array(4) {
["#attributes"]=>
array(2) {
["subjectType"]=>
string(7) "Subject"
["multipleNumber"]=>
string(1) "1"
}
["USMasterHeader"]=>
array(5) {
["CustomerReferenceNumber"]=>
string(6) "EFX QA"
["CustomerNumber"]=>
string(10) "999KI00553"
["ECOAInquiryType"]=>
string(1) "I"
["DateOfRequest"]=>
string(10) "02/23/2017"
["EquifaxReferenceNumber"]=>
string(9) "187391427"
}
["USConsumerCreditReport"]=>
array(6) {
["#attributes"]=>
array(2) {
["subjectType"]=>
string(7) "Subject"
["multipleNumber"]=>
string(1) "1"
}
["USHeader"]=>
array(3) {
["Request"]=>
array(6) {
["CustomerReferenceNumber"]=>
string(6) "EFX QA"
["CustomerNumber"]=>
string(10) "999KI00553"
["ConsumerReferralCode"]=>
string(3) "024"
["ECOAInquiryType"]=>
string(1) "I"
["NumberOfMonthsToCountInquiries"]=>
string(14) "Last 24 Months"
["NumberOfMonthsToCountDelinquencies"]=>
string(23) "Last 6 Years, 11 Months"
}
["CreditFile"]=>
array(11) {
["HitCode"]=>
array(1) {
["#attributes"]=>
array(2) {
["code"]=>
string(1) "1"
["description"]=>
string(3) "Hit"
}
}
["FileSinceDate"]=>
string(10) "04/16/2003"
["DateOfLastActivity"]=>
string(10) "01/24/2017"
["DateOfRequest"]=>
string(10) "02/23/2017"
["Identityscans"]=>
array(1) {
["Identityscan"]=>
array(1) {
["#attributes"]=>
array(2) {
["code"]=>
string(1) "8"
["description"]=>
string(74) "Unable to perform telephone validation due to insufficient telephone input"
}
}
}
["AddressDiscrepancyIndicator"]=>
string(1) "N"
["CreateCode"]=>
string(1) "2"
["FileStatus1"]=>
string(3) "016"
["FileStatus2"]=>
string(3) "242"
["FileStatus3"]=>
string(3) "004"
["BureauCode"]=>
string(3) "244"
}
["Subject"]=>
array(2) {
["SubjectName"]=>
array(3) {
["LastName"]=>
string(7) "DGNNLXZ"
["FirstName"]=>
string(7) "CHANITA"
["MiddleName"]=>
string(1) "S"
}
["SubjectId"]=>
array(2) {
["SubjectSSN"]=>
string(8) "66639074"
["DateOfBirth"]=>
string(10) "08/17/1988"
}
}
}
["USAddresses"]=>
array(1) {
["USAddress"]=>
array(3) {
[0]=>
array(8) {
["#attributes"]=>
array(2) {
["code"]=>
string(2) "CA"
["description"]=>
string(15) "Current Address"
}
["ParsedStreetAddress"]=>
array(3) {
["StreetNumber"]=>
string(4) "4338"
["StreetName"]=>
string(9) "W POTOMAC"
["StreetType"]=>
string(3) "AVE"
}
["City"]=>
string(7) "CHICAGO"
["State"]=>
string(2) "IL"
["PostalCode"]=>
string(5) "60651"
["DateAddressFirstReported"]=>
string(7) "07/2015"
["AddressSource"]=>
array(1) {
["#attributes"]=>
array(2) {
["code"]=>
string(1) "T"
["description"]=>
string(4) "Tape"
}
}
["DateAddressLastReported"]=>
string(7) "02/2017"
}
[1]=>
array(8) {
["#attributes"]=>
array(2) {
["code"]=>
string(2) "FA"
["description"]=>
string(14) "Former Address"
}
["ParsedStreetAddress"]=>
array(3) {
["StreetNumber"]=>
string(4) "1301"
["StreetName"]=>
string(7) "BRUMMEL"
["StreetType"]=>
string(8) "ST APT 8"
}
["City"]=>
string(8) "EVANSTON"
["State"]=>
string(2) "IL"
["PostalCode"]=>
string(5) "60202"
["DateAddressFirstReported"]=>
string(7) "04/2015"
["AddressSource"]=>
array(1) {
["#attributes"]=>
array(2) {
["code"]=>
string(1) "T"
["description"]=>
string(4) "Tape"
}
}
["DateAddressLastReported"]=>
string(7) "04/2015"
}
[2]=>
array(8) {
["#attributes"]=>
array(2) {
["code"]=>
string(2) "F2"
["description"]=>
string(21) "Second Former Address"
}
["ParsedStreetAddress"]=>
array(3) {
["StreetNumber"]=>
string(4) "1208"
["StreetName"]=>
string(11) "W JEFFERSON"
["StreetType"]=>
string(8) "ST APT C"
}
["City"]=>
string(11) "SPRINGFIELD"
["State"]=>
string(2) "IL"
["PostalCode"]=>
string(5) "62702"
["DateAddressFirstReported"]=>
string(7) "06/2014"
["AddressSource"]=>
array(1) {
["#attributes"]=>
array(2) {
["code"]=>
string(1) "T"
["description"]=>
string(4) "Tape"
}
}
["DateAddressLastReported"]=>
string(7) "06/2014"
}
}
}
["USEmployments"]=>
array(1) {
["USEmployment"]=>
array(3) {
["#attributes"]=>
array(2) {
["code"]=>
string(2) "ES"
["description"]=>
string(24) "Last Reported Employment"
}
["Occupation"]=>
string(14) "CORRECTION OFF"
["Employer"]=>
string(18) "MACON STATE PRISON"
}
}
["USFICO"]=>
array(3) {
["FICOScore"]=>
string(5) "00650"
["ScoreReasons"]=>
array(1) {
["ScoreReason"]=>
array(4) {
[0]=>
array(1) {
["#attributes"]=>
array(3) {
["code"]=>
string(5) "00038"
["description"]=>
string(69) "Serious delinquency, and derogatory public record or collection filed"
["number"]=>
string(1) "1"
}
}
[1]=>
array(1) {
["#attributes"]=>
array(3) {
["code"]=>
string(5) "00010"
["description"]=>
string(76) "Prop of balances to credit limits is too high on bank rev or other rev accts"
["number"]=>
string(1) "2"
}
}
[2]=>
array(1) {
["#attributes"]=>
array(3) {
["code"]=>
string(5) "00018"
["description"]=>
string(35) "Number of accounts with delinquency"
["number"]=>
string(1) "3"
}
}
[3]=>
array(1) {
["#attributes"]=>
array(3) {
["code"]=>
string(5) "00014"
["description"]=>
string(45) "Length of time accounts have been established"
["number"]=>
string(1) "4"
}
}
}
}
["ScoreIndicator"]=>
array(1) {
["#attributes"]=>
array(2) {
["code"]=>
string(1) "J"
["description"]=>
string(39) "FICO Score 5 based on Equifax Data (NF)"
}
}
}
["USIdentificationSSN"]=>
array(4) {
["MDBSubjectSSN"]=>
string(9) "666390749"
["InquirySubjectSSN"]=>
string(9) "666390749"
["InquirySSNDateIssued"]=>
string(4) "1992"
["InquirySSNStateIssued"]=>
string(2) "GA"
}
}
["USDecisionPowerExpressSegment"]=>
array(4) {
["ConsumerDisclosureIndicator"]=>
array(0) {
}
["ReportTextMessage"]=>
string(7) "OFFER C"
["SSNVarianceIndicator"]=>
array(0) {
}
["DPExpressProducts"]=>
array(1) {
["DPExpressProduct"]=>
array(4) {
[0]=>
array(5) {
["#attributes"]=>
array(1) {
["number"]=>
string(1) "1"
}
["Description"]=>
string(1) "A"
["ApprovalIndicator"]=>
string(1) "N"
["Limit"]=>
array(0) {
}
["Miscellaneous"]=>
array(0) {
}
}
[1]=>
array(5) {
["#attributes"]=>
array(1) {
["number"]=>
string(1) "2"
}
["Description"]=>
string(1) "B"
["ApprovalIndicator"]=>
string(1) "N"
["Limit"]=>
array(0) {
}
["Miscellaneous"]=>
array(0) {
}
}
[2]=>
array(5) {
["#attributes"]=>
array(1) {
["number"]=>
string(1) "3"
}
["Description"]=>
string(1) "C"
["ApprovalIndicator"]=>
string(1) "Y"
["Limit"]=>
array(0) {
}
["Miscellaneous"]=>
array(0) {
}
}
[3]=>
array(5) {
["#attributes"]=>
array(1) {
["number"]=>
string(1) "4"
}
["Description"]=>
string(1) "D"
["ApprovalIndicator"]=>
string(1) "N"
["Limit"]=>
array(0) {
}
["Miscellaneous"]=>
array(0) {
}
}
}
}
}
}
}
["USPrintImage"]=>
array(0) {
}
}
}
What's the error you're getting? Try:
$tester = $array['EfxReport']['USDecisionPowerExpressReports']['USDecisionPowerExpressReport']['USConsumerCreditReport']['USFICO']['FICOScore'];
Also I really hope this is fake data, you've included very personal/sensitive information in your array printout.

Extracting triples from text in php using Stanford-NLP?

I have a text .. I went to extract triples from text .. I use Stanford-NLP Library in php Standford-NLP How can I extract triples(subject - object - predicate)?
The example code in the GitHub ReadMe shows how to write the code. The output is a list of word/part-of-speech pairs. Looking at the first example,
"What does the fox say?" becomes:
array(3) {
["wordsAndTags"]=>
array(6) {
[0]=>
array(2) {
[0]=>
string(4) "What"
[1]=>
string(2) "WP"
}
[1]=>
array(2) {
[0]=>
string(4) "does"
[1]=>
string(3) "VBZ"
}
[2]=>
array(2) {
[0]=>
string(3) "the"
[1]=>
string(2) "DT"
}
[3]=>
array(2) {
[0]=>
string(3) "fox"
[1]=>
string(2) "NN"
}
[4]=>
array(2) {
[0]=>
string(3) "say"
[1]=>
string(2) "VB"
}
[5]=>
array(2) {
[0]=>
string(1) "?"
[1]=>
string(1) "."
}
}
["penn"]=>
array(2) {
["parent"]=>
string(4) "ROOT"
["children"]=>
array(1) {
[0]=>
array(2) {
["parent"]=>
string(5) "SBARQ"
["children"]=>
array(3) {
[0]=>
array(2) {
["parent"]=>
string(4) "WHNP"
["children"]=>
array(1) {
[0]=>
array(2) {
["parent"]=>
string(7) "WP What"
["children"]=>
array(0) {
}
}
}
}
[1]=>
array(2) {
["parent"]=>
string(2) "SQ"
["children"]=>
array(3) {
[0]=>
array(2) {
["parent"]=>
string(8) "VBZ does"
["children"]=>
array(0) {
}
}
[1]=>
array(2) {
["parent"]=>
string(2) "NP"
["children"]=>
array(2) {
[0]=>
array(2) {
["parent"]=>
string(6) "DT the"
["children"]=>
array(0) {
}
}
[1]=>
array(2) {
["parent"]=>
string(6) "NN fox"
["children"]=>
array(0) {
}
}
}
}
[2]=>
array(2) {
["parent"]=>
string(2) "VP"
["children"]=>
array(1) {
[0]=>
array(2) {
["parent"]=>
string(6) "VB say"
["children"]=>
array(0) {
}
}
}
}
}
}
[2]=>
array(2) {
["parent"]=>
string(3) ". ?"
["children"]=>
array(0) {
}
}
}
}
}
}
["typedDependencies"]=>
array(5) {
[0]=>
array(3) {
["type"]=>
string(4) "dobj"
[0]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
[1]=>
array(2) {
["feature"]=>
string(4) "What"
["index"]=>
int(1)
}
}
[1]=>
array(3) {
["type"]=>
string(3) "aux"
[0]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
[1]=>
array(2) {
["feature"]=>
string(4) "does"
["index"]=>
int(2)
}
}
[2]=>
array(3) {
["type"]=>
string(3) "det"
[0]=>
array(2) {
["feature"]=>
string(3) "fox"
["index"]=>
int(4)
}
[1]=>
array(2) {
["feature"]=>
string(3) "the"
["index"]=>
int(3)
}
}
[3]=>
array(3) {
["type"]=>
string(5) "nsubj"
[0]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
[1]=>
array(2) {
["feature"]=>
string(3) "fox"
["index"]=>
int(4)
}
}
[4]=>
array(3) {
["type"]=>
string(4) "root"
[0]=>
array(2) {
["feature"]=>
string(4) "ROOT"
["index"]=>
int(0)
}
[1]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
}
}
}
Then I need to extract triples .. How can I do that?

After Drupal update show Errors

I've updated a Drupal from version 7.2 to version 7.26.
After do that I've some errors:
throw new EntityMalformedException (Missing bundle property on entity of type taxonomy_term)
It appears in file common . inc:
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
I insert some "echos" to see when is shown this message, and I get this:
var_dump( $info['entity keys']);
array(4) {
["id"]=>
string(3) "tid"
["bundle"]=>
string(23) "vocabulary_machine_name"
["label"]=>
string(4) "name"
["revision"]=>
string(0) ""
}
array(4) {
["id"]=>
string(3) "tid"
["bundle"]=>
string(23) "vocabulary_machine_name"
["label"]=>
string(4) "name"
["revision"]=>
string(0) ""
}
var_dump( $info);
array(22) {
["label"]=>
string(22) "Término de taxonomía"
["controller class"]=>
string(22) "TaxonomyTermController"
["base table"]=>
string(18) "taxonomy_term_data"
["uri callback"]=>
string(17) "taxonomy_term_uri"
["fieldable"]=>
bool(true)
["entity keys"]=>
array(4) {
["id"]=>
string(3) "tid"
["bundle"]=>
string(23) "vocabulary_machine_name"
["label"]=>
string(4) "name"
["revision"]=>
string(0) ""
}
["bundle keys"]=>
array(1) {
["bundle"]=>
string(12) "machine_name"
}
["bundles"]=>
array(3) {
["pais"]=>
array(3) {
["label"]=>
string(7) "Regions"
["admin"]=>
array(4) {
["path"]=>
string(58) "admin/structure/taxonomy/%taxonomy_vocabulary_machine_name"
["real path"]=>
string(29) "admin/structure/taxonomy/pais"
["bundle argument"]=>
int(3)
["access arguments"]=>
array(1) {
[0]=>
string(19) "administer taxonomy"
}
}
["rdf_mapping"]=>
array(5) {
["rdftype"]=>
array(1) {
[0]=>
string(12) "skos:Concept"
}
["name"]=>
array(1) {
["predicates"]=>
array(2) {
[0]=>
string(10) "rdfs:label"
[1]=>
string(14) "skos:prefLabel"
}
}
["description"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(15) "skos:definition"
}
}
["vid"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(13) "skos:inScheme"
}
["type"]=>
string(3) "rel"
}
["parent"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(12) "skos:broader"
}
["type"]=>
string(3) "rel"
}
}
}
["auto_created_voc38877"]=>
array(3) {
["label"]=>
string(10) "Provincias"
["admin"]=>
array(4) {
["path"]=>
string(58) "admin/structure/taxonomy/%taxonomy_vocabulary_machine_name"
["real path"]=>
string(46) "admin/structure/taxonomy/auto_created_voc38877"
["bundle argument"]=>
int(3)
["access arguments"]=>
array(1) {
[0]=>
string(19) "administer taxonomy"
}
}
["rdf_mapping"]=>
array(5) {
["rdftype"]=>
array(1) {
[0]=>
string(12) "skos:Concept"
}
["name"]=>
array(1) {
["predicates"]=>
array(2) {
[0]=>
string(10) "rdfs:label"
[1]=>
string(14) "skos:prefLabel"
}
}
["description"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(15) "skos:definition"
}
}
["vid"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(13) "skos:inScheme"
}
["type"]=>
string(3) "rel"
}
["parent"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(12) "skos:broader"
}
["type"]=>
string(3) "rel"
}
}
}
["busquedas_destacadas_"]=>
array(3) {
["label"]=>
string(21) "Búsquedas destacadas"
["admin"]=>
array(4) {
["path"]=>
string(58) "admin/structure/taxonomy/%taxonomy_vocabulary_machine_name"
["real path"]=>
string(46) "admin/structure/taxonomy/busquedas_destacadas_"
["bundle argument"]=>
int(3)
["access arguments"]=>
array(1) {
[0]=>
string(19) "administer taxonomy"
}
}
["rdf_mapping"]=>
array(5) {
["rdftype"]=>
array(1) {
[0]=>
string(12) "skos:Concept"
}
["name"]=>
array(1) {
["predicates"]=>
array(2) {
[0]=>
string(10) "rdfs:label"
[1]=>
string(14) "skos:prefLabel"
}
}
["description"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(15) "skos:definition"
}
}
["vid"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(13) "skos:inScheme"
}
["type"]=>
string(3) "rel"
}
["parent"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(12) "skos:broader"
}
["type"]=>
string(3) "rel"
}
}
}
}
["view modes"]=>
array(1) {
["full"]=>
array(2) {
["label"]=>
string(34) "Página de términos de taxonomía"
["custom settings"]=>
bool(false)
}
}
["static cache"]=>
bool(true)
["field cache"]=>
bool(true)
["load hook"]=>
string(18) "taxonomy_term_load"
["translation"]=>
array(0) {
}
["schema_fields_sql"]=>
array(1) {
["base table"]=>
array(8) {
[0]=>
string(3) "tid"
[1]=>
string(3) "vid"
[2]=>
string(4) "name"
[3]=>
string(11) "description"
[4]=>
string(6) "format"
[5]=>
string(6) "weight"
[6]=>
string(8) "language"
[7]=>
string(9) "i18n_tsid"
}
}
["token type"]=>
string(4) "term"
["access callback"]=>
string(31) "entity_metadata_taxonomy_access"
["creation callback"]=>
string(29) "entity_metadata_create_object"
["save callback"]=>
string(18) "taxonomy_term_save"
["deletion callback"]=>
string(20) "taxonomy_term_delete"
["view callback"]=>
string(27) "entity_metadata_view_single"
["form callback"]=>
string(34) "entity_metadata_form_taxonomy_term"
["configuration"]=>
bool(false)
}
I supposed this is related with something missing in the database. But I can't find it.
Any help, please?
Thanks in advance.

Categories