Solved

PHP array to text and back to array

Posted on 2014-02-18
4
521 Views
Last Modified: 2014-02-18
i want to send an entire POST array thru a single (text) API GET param and
process it (remotely in the API)

what is the best way to "encode" or "compress" or "convert" a PHP array into a text string
such that it can be easily  re-constituted back to the original array at the other end.

thanks
0
Comment
Question by:willsherwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Assisted Solution

by:Gregory Miller
Gregory Miller earned 250 total points
ID: 39869170
I would use serialization. Here is a link from the PHP manual: http://www.php.net/manual/en/language.oop5.serialization.php
0
 
LVL 58

Accepted Solution

by:
Gary earned 250 total points
ID: 39869177
How is the array being constructed? In PHP?
You may want to look at json_encode to convert to a string and then in the reverse json_decode to get the string back as an array
0
 

Author Comment

by:willsherwood
ID: 39869196
a POST array is constructed by the web browser i would suppose.
0
 

Author Closing Comment

by:willsherwood
ID: 39869209
both excellent approaches i was not aware of.
thanks!!!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question