# PHP scripting to get.post\_process

**URL:** <https://community.dreamfactory.com/t/php-scripting-to-get-post-process/2467>\
**Category:** Server-Side Scripting\
**Created:** [April 3, 2016, 8:13pm UTC](https://community.dreamfactory.com/t/php-scripting-to-get-post-process/2467 "2016-04-03T20:13:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farhad33](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/farhad33/32/611_2.png) [@Farhad33](https://community.dreamfactory.com/u/Farhad33)\
**Post date:** [April 3, 2016, 8:13pm UTC](https://community.dreamfactory.com/t/php-scripting-to-get-post-process/2467/1 "2016-04-03T20:13:17Z")

</div>

Hello all, I have a MySQL database that is connected to dreamfactory, but some of my records are serialized (PHP). I wrote a PHP script to unserialize it whenever I send a “GET” network request, but it’s not working. I am obtaining my database information from a Swift xcode project using AFNetworking and would like to display the unserialized information.

Can anyone see which part am I doing wrong?  
Here’s where I put my php script and the script itself:

mysql.\_table.[table\_name}.{id}.get.post\_process

$data = $response.meta\_value;  
function toJSON($theDATA) {  
$uns = unserialize(unserialize($theDATA));  
$DATA = json\_encode($uns);  
return $DATA;  
}  
$new\_data = toJSON($data);  
return $new\_data;

# ============= this is the php serialize: { “meta\_value” = “s:306:“a:1:{i:274;a:1:{s:9:“schedules”;a:1:{s:13:“56f5dc96a042f”;a:5:{s:13:“minutes\_start”;s:3:“540”;s:11:“minutes\_end”;s:4:“1020”;s:5:“weeks”;a:7:{i:1;s:2:“on”;i:2;s:2:“on”;i:3;s:2:“on”;i:4;s:2:“on”;i:5;s:2:“on”;i:6;s:2:“on”;i:0;s:2:“on”;}s:10:“date\_start”;s:10:“03/25/2016”;s:8:“date\_end”;s:10:“06/15/2016”;}}}}”;”; }

and this is what I am trying to get which is json body:

{“274”:{“schedules”:{“56f5dc96a042f”:{“minutes\_start”:“540”,“minutes\_end”:“1020”,“weeks”:{“1”:“on”,“2”:“on”,“3”:“on”,“4”:“on”,“5”:“on”,“6”:“on”,“0”:“on”},“date\_start”:“03/25/2016”,“date\_end”:“06/15/2016”}}}}
