Question

I have what I think is a ByteArray. When using urlencode on the string, I get this data...

%0A%82%03%01%11SaleDate%0DToYear%0DYardId%15BuyNowOnly%0BState%0BModel%0FStockId%11FromYear%11FullText%13Inventory%11Category%09Make%0FOrderBy%1DOrderDirection%0FPageNum%11PageSize%01%01%06%05-1%02%06%01%01%01%01%06%0F1024187%06%09Sale%01%01%06%13RunNumber%06%07Asc%04%01%04d

I am looking at the php function unpack, and trying unpack('c4char/Xstr/...') where X is a, A, h, H to try to pull the "SaleDate" string out, but I can't get it to work.

Probably the completely wrong approach. Do I need to write a custom unpacker of some sort?

I'm not even sure what I'm dealing with here, it's the output from a flash file, so I think it's an Amf "ByteArray" but I'm at a loss as to how to parse it.

Looking for even just a direction to start hunting for how to manipulate/parse/rebuild something like this. Ultimately I'd love to be able to run it through a function, get an associative array, change a few values, repack it, and send it on it's merry way.

I think it's AMF3 and this is the data in the messages part.

I guess if there's one "main" question, how do I manipulate that string of data simply and safely?

Thanks for any leads.

Was it helpful?

Solution 2

As far as I can tell, this appears to be a proprietary encoding method specific to the vendor. They use a "Byte Array" to allow greater flexibility of the payload. There isn't an easy way to work with this, without completely reverse engineering their encoding and decoding algorithms.

OTHER TIPS

There are a lot of AMF deserializers out there that are open source, for simplicity sake, would probably make a lot of sense to not roll your own here, even though AMF3 is fairly simple.

I came across this link on github which looks promising:

https://github.com/silexlabs/amfphp-2.0

You probably don't want to roll the whole framework, but can probably roll this:

/core/amf/Deserializer.php

/core/amf/Serializer.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top