Hello everyone,
I’ve got a string serialized by PHP, someone can help me understand how to transform that string in a readeable array?
Hello everyone,
I’ve got a string serialized by PHP, someone can help me understand how to transform that string in a readeable array?
Hello @AndreaM,
Can you please post an example of a serialized string?
Here an example:
a:17:{s:9:"user_name";s:5:"xxxxx";s:8:"password";s:5:"yyyyy";s:11:"environment";s:9:"xyxyxyxxy";s:10:"ftp_export";s:5:"false";s:11:"json_format";s:1:"N";s:14:"export_barcode";s:1:"N";s:6:"codice";s:10:"9990099999";s:6:"lingua";s:3:"ITA";s:18:"No_spese_trasporto";s:4:"true";s:16:"No_calcola_promo";s:4:"true";s:21:"No_spese_contrassegno";s:4:"true";s:13:"id_spedizione";s:6:"000001";s:16:"codice_pagamento";s:2:"CC";s:17:"richiesta_fattura";s:5:"false";s:6:"pickup";s:0:"";s:16:"auto_ordinamento";s:5:"false";s:8:"xml_data";s:550:"<CART RIFEST="OL68137" NOTEOC="" DATEST="20251212" NOTEST=""><CARTROW id="1" tip="ART" art="myart1" col="00001" tag="5" qta="1" prz="13.9" imp="13.9" gen="" /><CARTROW id="2" tip="ART" art="myart2" col="00002" tag="5" qta="1" prz="13.9" imp="13.9" gen="" /><CARTROW id="3" tip="ART" art="myart3" col="00001" tag="5" qta="1" prz="16.9" imp="16.9" gen="" /><CARTROW id="4" tip="ART" art="myart4" col="00002" tag="5" qta="1" prz="16.9" imp="16.9" gen="" /><CARTROW id="5" tip="ART" art="myart5" col="" tag="" qta="1" prz="3.9" imp="3.9" gen="" /></CART>";}
Using the unserialize() function of PHP we’ve got:
Array
(
[user_name] => xxxxx
[password] => yyyyy
[environment] => xyxyxyxxy
[ftp_export] => false
[json_format] => N
[export_barcode] => N
[codice] => 9990099999
[lingua] => ITA
[No_spese_trasporto] => true
[No_calcola_promo] => true
[No_spese_contrassegno] => true
[id_spedizione] => 000001
[codice_pagamento] => CC
[richiesta_fattura] => false
[pickup] =>
[auto_ordinamento] => false
[xml_data] => <CART RIFEST="OL68137" NOTEOC="" DATEST="20251212" NOTEST=""><CARTROW id="1" tip="ART" art="myart1" col="00001" tag="5" qta="1" prz="13.9" imp="13.9" gen="" /><CARTROW id="2" tip="ART" art="myart2" col="00002" tag="5" qta="1" prz="13.9" imp="13.9" gen="" /><CARTROW id="3" tip="ART" art="myart3" col="00001" tag="5" qta="1" prz="16.9" imp="16.9" gen="" /><CARTROW id="4" tip="ART" art="myart4" col="00002" tag="5" qta="1" prz="16.9" imp="16.9" gen="" /><CARTROW id="5" tip="ART" art="myart5" col="" tag="" qta="1" prz="3.9" imp="3.9" gen="" /></CART>
)
The problem is that we cannot use the unserialize() function, we only have the serialized string.
Any idea?
You can try to ask an AI chatbot to create a PowerShell or Python version of the unserialize() function and use the corresponding action to run that code.
Hi @AndreaM ,
The one practical approach I can see is doing this in Python, using either Call Python or Run Program. The phpserialize library may help with this format, though I have not used it myself.
You can use phpserialize module. Easy to use in python script and easy integration with Easymorph. Decent performance.