send Array Collection to PHP page

284 views
Skip to first unread message

Ranjan

unread,
Nov 13, 2007, 12:55:07 AM11/13/07
to Flex India Community
Hi everybody,
i've a requirement to send an Arraycollection to a php page.
Does anyone have idea??

Abdul Qabiz

unread,
Nov 14, 2007, 5:44:41 AM11/14/07
to flex_...@googlegroups.com
You have to convert ArrayCollection to a format, if you are using HTTPService, you expect on server.

Format could be:-

1) XML
2) Name-Value pairs
3) Text
4) ByteArray (if you are using URLLoader instead of HTTPService)
5) AMF (If you are using RemoteObject on flex side and AMFPHP on server-side). You can pass ActionScript Arrays without any conversion, on php side you would get object (array or associative array).

-abdul
--
-abdul
---------------------------------------
http://abdulqabiz.com/blog/
---------------------------------------

selcukartut

unread,
Nov 16, 2007, 6:26:25 AM11/16/07
to Flex India Community
hello,
Can you tell how to convert array to an xml ?
best wishes
selcukartut

tariq

unread,
Nov 16, 2007, 11:04:25 PM11/16/07
to Flex India Community
Hi,
I dont know whether you want to do this in php.
If it is in php then go through the following codes.

<?
$arr = array('a','b','c');
$count = count($arr);
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>");
echo("<ALPHABETS total='$count'>");
for($i=0;$i<count($arr);$i++)
{
echo("<VALUE>$arr[$i]</VALUE>");
}
echo("</ALPHABETS>");
?>

The output would be of this format

<?xml version="1.0" encoding="iso-8859-1" ?>
<ALPHABETS total='3'>
<VALUE>a</VALUE>
<VALUE>b</VALUE>
<VALUE>c</VALUE>
</ALPHABETS>

regards
tariq
> > Does anyone have idea??- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages