1

I have been working on some QR codes, I need to pass an array to the QR with the data but it needs encoding. The data itself is a json_array which is used to generate a PDF.

If I use base64 encoding the QR code is stupidly large, and when using ascii85 it breaks the QR.

Can you let me know of any encoding praticies which would work in the url, the shorted the coding the betetr. qr_generator.php?data={encoded_json_array}

2
  • try converting that to php array and using serialize Commented Dec 16, 2014 at 10:29
  • Already tried that method. Base64 is the best so far but its over sized. Commented Dec 16, 2014 at 10:31

1 Answer 1

2

You can try this:

urlencode($string);

It encodes a string to be appended as an url parameter. So if you have an array, try:

urlencode(json_encode($array);

Sign up to request clarification or add additional context in comments.

2 Comments

Has the same effect as the base64, the string is too large.
You can't really encode the string to be a lot less in size, unless you accept all unicode characters in you url (which you don't want for security reasons). You could also store the information in a session along with a random key and put that key in the url

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.