Pergunta

I am working on migrating posts from the RightNow infrastructure to another service called ZenDesk. I noticed that whenever users added files or even URL links, when I pull the xml data from RightNow it gives me a lot of weird codes like this:

{s:3:""url"";s:45:""/files/56f5be6c1/MUG_presso.pdf"";s:4:""name"";s:27:""MUG presso.pdf"";s:4:""size"";s:5:""2.1MB"";}

It wasn't too hard to write something that parses them and makes normal urls and links, but I was just wondering if this is something specific to the RightNow service, or if it is a tag system that is used. I tried googling for this but am getting some weird results so, thought stack overflow might have someone who has run into this one.

So, anyone know what these {s ;} tags are called and if there are any particular tools to use to read them?

Any answers appreciated!

Foi útil?

Solução

This resembles partial PHP serialized data, as returned by the serialize() call. It looks like someone may have turned each " into "", which could prevent it from parsing properly. If it's wrapped with text like this before the {s: section, it's almost definitely PHP.

a:6:{i:1;a:10:{s:

These letters/numbers mean things like "an array with six elements follows", "a string of length 20 follows", etc.

You can use any PHP instance with unserialize() to handle the data. If those double-quotes are indeed returned by the API, you might need to replace :"" and ""; with " before parsing.

Parsing modules exist for other languages like Python. You can find more information in this answer.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top