ajoo Posted March 19, 2018 Share Posted March 19, 2018 Hi, Is it possible to read the bytecode of a an uncompressed swf file into a binary array in php? If so, how? Thanks all !! Quote Link to comment Share on other sites More sharing options...
kicken Posted March 19, 2018 Share Posted March 19, 2018 What do you mean by read the bytecode? fread can read binary data. unpack can convert binary data into usable data if you need to do that. Quote Link to comment Share on other sites More sharing options...
ajoo Posted March 19, 2018 Author Share Posted March 19, 2018 Hi Kicken, Thanks for the reply. I want to read the swf as it's binary executable form and store that into an array. Bytecode is the binary executable that is loaded into memory when executing a .swf file. Thanks. Quote Link to comment Share on other sites More sharing options...
kicken Posted March 19, 2018 Share Posted March 19, 2018 I'm not familiar with the SWF format so maybe I'm not understanding something, but you can load the file into a string by just doing file_get_contents('whatever.swf') and stuff that string into your array. If you need to extract a specific part of the data then use substr. If you need to decode some binary data such as integer lengths to know how much data to extract use unpack. Quote Link to comment Share on other sites More sharing options...
ajoo Posted March 21, 2018 Author Share Posted March 21, 2018 (edited) Hi Kicken, Thanks for the reply. I have actually tried out your suggestion and I could manage to send the swf, loaded into a string using file_get_contents, into flash. If I echo out the string in php, this is what it gives. CWS ~xSKOQþf¦ó(¥*/I[Ñ!.JJ£c´>k£SÄ7u(Sh§dz¡5!)>¢h¢qUÂÂğàÂ+ë҈㊝ÃqeL©çÎÒ.HŜs¿{ÏwÎùνUÈ9 ôèp±ô]ÍæYiW6я1dK%vyÉ4§m¦^fkΨN°¢çÍêefËÌ.Zó8°*;ïą́2äl۰Øtö*XªÄÍR^gŒ_°B¦ÜØ%Y9lAÏÈë&åbv9jÃÝ{7uZ2îúãxqiÝX0öJ Gk P÷CJ}B"u}"@à¸Ԋû8.Ôð ¼ïJ8üJDõ^hr®ûJ6Z÷Ѷ&;K5Ý Óö÷TøD'a»Â?·+åÖáa6ɗräե´N·â s¸kÿCο;{õ4·È7=^|Ø9xhÂaémû&&U4#>óÛɯÛïüSÝ}ýý±Ç[;ÅhøÎV í¡";"k· üÿ¸¯srÌ(3d¬eÝ,Î OÞ-iâv+:õJ^p§áÄÃn,Î'âåJ9ÓX6ÌHý.G}ÒÍSACé"¦<zߎÎ2+A½!LÂmÁPJ@s#I½?¯cOOì¬Gë¿PóA¸#$¹Í7çȍ=[¤lÍ0eȂrÎ.҅æÕ¦jþQrTþڛÀLpXÆOBMѽO£J6Îéë{·Röñ2C^~^myu5? үÈ÷ÝûǰG}jPm#tôP\ùñÀyf.æ1^=IkcrÔPù`6vÞg ¿nño Length : undefined But strangely, the length of the string = undefined in Flash. So I am unable to manipulate it. Does this have to do with the fact that the .swf is a binary file format? How can I then store and retrieve it back as a byteArray? Thanks loads. Edited March 21, 2018 by ajoo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.