Solved

PHP array to text and back to array

Posted on 2014-02-18
4
498 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
  • 2
4 Comments
 
LVL 11

Assisted Solution

by:Technodweeb
Technodweeb 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now