문제

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.

도움이 되었습니까?

해결책 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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top