Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

using json to get the form data to assign it into php variables

Dear Experts,
I use below code to see what is posted to my web page. I see everything here .
echo file_get_contents('php://input');

// the output is like
RESPONSE.DATETIME=2017-04-25%2B08%253a35%253a42Z&RESPONSE.ID=258&ORDER.REFERENCE=lusn4YZ7SGOWs9qx4isLpqbuc&ORDER.DATETIME=2017-04-25%2B11%253a35%253a42Z&ORDER.CUSTOMREFERENCE=myvalue So on…

what I want to do is to assign every input into a variable to insert them into my database.
how can I do that?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Where does this information come from (name of the data service)? Do they have any online docs?  Is there an important reason why you are reading from php://input instead of using the standard PHP request variables like $_GET and $_POST?

Generally speaking, when you have data coming from an external source, it's helpful to map the request variables key names like RESPONSE.DATETIME and ORDER.REFERENCE to the database column names.  You can do this by making the key:column match exactly, or you can do it with a translation table.
Avatar of BR

ASKER

Dear Ray Paseur,
Thank you very much, I think I shouldn't make public of the company name here..

I don't have specific reason to use the php://input but I can only see it that way. ( I don't know the other ways )

Marco Gassi said, Json is a better way to list what is posted to my page, that is why I searched on the web, and used php://input to get the input data that I was searching for.

Actually it brings everything I need but it is like this RESPONSE.DATETIME=2017-04-25%2B08%253a35%253a42Z&RESPONSE.ID=258&
I need to assign $responseDateTime ="2017-04-25%2B08%253a35%253a42Z" and $responseID=258;

I'm open to learn every possible way to get the data. Thank you
OK, but without any online documentation, it's going to require a lot of guessing.  I can't imagine why any company that offers a payment API would not welcome free publicity!

Let's do this... Take your test script that receives this information from the API and add the following bits of code.  Gather the outputs (two separate outputs) and post the outputs here in the code snippet.  You can obscure anything like passwords, but please post complete examples showing all of the data from the API.

This will give us the raw request data (we have part of it, above)
echo file_get_contents('php://input');

Open in new window

This will give us the PHP interpretation of the request
var_export($_POST);

Open in new window

Once we have that, I can probably show you how to break it down into something more manageable.
Avatar of BR

ASKER

I used var_export($_POST) and it brings me the exactly the same with var_dump($_POST); which I can not see everything posted to me because of the issue I mention at the other question. Thank you
Avatar of BR

ASKER

I have just seen your answer, please give a minute... thank you
Sidebar note... You can mark your questions "Private" and E-E will not permit them to be indexed by search engines.  Ask E-E customer support how to do this if you're concerned about information leaking out of your questions to the internet at large.
var_export($_POST) and it brings me the exactly the same with var_dump($_POST);
Sort of... The difference is small but important for working together in a forum like E-E.  Var_dump() produces readable information.  Var_export() produces a data structure that can be copied and injected directly into a script.  It's much easier for me to work with var_export() data.
http://php.net/manual/en/function.var-export.php
Avatar of BR

ASKER

Dear Ray,
the result of file_get_contents

RESPONSE.DATETIME=2017-04-25%2B09%253a28%253a59Z&RESPONSE.ID=260&ORDER.REFERENCE=svoO75UABHdvh1lkHq5R2U9i10qTKlJI90v5ZJcVW0&ORDER.DATETIME=2017-04-25%2B12%253a28%253a57Z&ORDER.CUSTOMREFERENCE=webmaster&REQUEST.ID=317&REQUEST.STATUSID=20&REQUEST.ERROR=%257b%257d&TRANSACTION%5B0%5D.COMMRATE=2%252c3000&TRANSACTION%5B0%5D.COMMTYPEID=10&TRANSACTION%5B0%5D.ID=328&TRANSACTION%5B0%5D.INST=1&TRANSACTION%5B0%5D.CARDBRAND=20&TRANSACTION%5B0%5D.VPOSID=6&TRANSACTION%5B0%5D.VPOSAPIID=80&TRANSACTION%5B0%5D.PAYSETID=7&TRANSACTION%5B0%5D.PAYSETNAME=NKolayDepo&TRANSACTION%5B0%5D.PINST=0&TRANSACTION%5B0%5D.PDEFER=0&TRANSACTION%5B0%5D.REFERENCE=NT40642P0000000328&TRANSACTION%5B0%5D.ISTEST=False&TRANSACTION%5B0%5D.DETAIL%5B0%5D.ID=482&TRANSACTION%5B0%5D.DETAIL%5B0%5D.AMOUNT=1%252c00&TRANSACTION%5B0%5D.DETAIL%5B0%5D.DATETIME=2017-04-25%2B12%253a28%253a37Z&TRANSACTION%5B0%5D.DETAIL%5B0%5D.ERROR=%257b%257d&TRANSACTION%5B0%5D.DETAIL%5B0%5D.NETAMOUNT=0%252c98&TRANSACTION%5B0%5D.DETAIL%5B0%5D.STATUS=1&TRANSACTION%5B0%5D.DETAIL%5B0%5D.TYPE=40&HASH=e5ba359894e1a1a2e81289342a776309dcf6fbd0b8bebed92e84dfc7237d0452

Open in new window


and the result of var_export
 array ( 'RESPONSE_DATETIME' => '2017-04-25+09%3a28%3a59Z', 'RESPONSE_ID' => '260', 'ORDER_REFERENCE' => 'svoO75UABHdvh1lkHq5R2U9i10qTKlJI90v5ZJcVW0', 'ORDER_DATETIME' => '2017-04-25+12%3a28%3a57Z', 'ORDER_CUSTOMREFERENCE' => 'webmaster', 'REQUEST_ID' => '317', 'REQUEST_STATUSID' => '20', 'REQUEST_ERROR' => '%7b%7d', 'TRANSACTION' => array ( 0 => '40', ), 'HASH' => 'e5ba359894e1a1a2e81289342a776309dcf6fbd0b8bebed92e84dfc7237d0452', )  

Open in new window

Great, thanks.  Let me see what I can do with those...
We may also want to see the request headers.  This should enable you to get that information (untested, but worth a try).
<?php
$request = $_SERVER['SERVER_PROTOCOL'] .' '. $_SERVER['REQUEST_METHOD'] .' '. $_SERVER['REQUEST_URI'] . PHP_EOL;
foreach (getallheaders() as $key => $value) {
    $request .= trim($key) .': '. trim($value) . PHP_EOL;
}
print_r($request);

Open in new window

Avatar of BR

ASKER

I used it and the answer is like:

HTTP/1.1 POST /success.php?s=success&m=r9KsSb8y6EsKsLKzdguZN0 Cookie: PHPSESSID=9i7gr51k5egemdqrra2506n4o5; _ga=GA1.2.72493803.1478618775 Accept-Language: en-US,en;q=0.8,hu;q=0.6 Accept-Encoding: gzip, deflate, br Referer: https://xxxxxxxxxxxxxxxxx Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1287.133 Safari/537.36 Upgrade-Insecure-Requests: 1 Origin: https://xxxxxxxxx.com Cache-Control: max-age=0 Content-Length: 1099 Connection: close Host: xxxxxxxxx.com

Open in new window

I still think there is something going wrong here.  It looks like the data has been URL-encoded twice, and that is plainly an error on the part of the sending API.  I really need to see their documentation.  Please send me an email with a link to the docs.  You can find my email in my public profile here at E-E, and for convenience, it is reproduced here: Ray.Paseur [at] Gmail.com
Avatar of BR

ASKER

I sent it Ray. Thank you.
Here's the sort of thing I'm getting from the raw request.  Looks like TRANSACTION might be an array, and we are looking at position zero (the first element).   Inside that array, we find things like COMMRATE, COMMTYPEID, etc.  We also find DETAIL, and it looks like an array (a nested array) inside TRANSACTION.

Important question: Do you expect to receive more than one TRANSACTION in each call to the API?
(
    [0]  => RESPONSE.DATETIME=2017-04-25 09:28:59Z
    [1]  => RESPONSE.ID=260
    [2]  => ORDER.REFERENCE=svoO75UABHdvh1lkHq5R2U9i10qTKlJI90v5ZJcVW0
    [3]  => ORDER.DATETIME=2017-04-25 12:28:57Z
    [4]  => ORDER.CUSTOMREFERENCE=webmaster
    [5]  => REQUEST.ID=317
    [6]  => REQUEST.STATUSID=20
    [7]  => REQUEST.ERROR={}
    [8]  => TRANSACTION[0].COMMRATE=2,3000
    [9]  => TRANSACTION[0].COMMTYPEID=10
    [10] => TRANSACTION[0].ID=328
    [11] => TRANSACTION[0].INST=1
    [12] => TRANSACTION[0].CARDBRAND=20
    [13] => TRANSACTION[0].VPOSID=6
    [14] => TRANSACTION[0].VPOSAPIID=80
    [15] => TRANSACTION[0].PAYSETID=7
    [16] => TRANSACTION[0].PAYSETNAME=NKolayDepo
    [17] => TRANSACTION[0].PINST=0
    [18] => TRANSACTION[0].PDEFER=0
    [19] => TRANSACTION[0].REFERENCE=NT40642P0000000328
    [20] => TRANSACTION[0].ISTEST=False
    [21] => TRANSACTION[0].DETAIL[0].ID=482
    [22] => TRANSACTION[0].DETAIL[0].AMOUNT=1,00
    [23] => TRANSACTION[0].DETAIL[0].DATETIME=2017-04-25 12:28:37Z
    [24] => TRANSACTION[0].DETAIL[0].ERROR={}
    [25] => TRANSACTION[0].DETAIL[0].NETAMOUNT=0,98
    [26] => TRANSACTION[0].DETAIL[0].STATUS=1
    [27] => TRANSACTION[0].DETAIL[0].TYPE=40
    [28] => HASH=e5ba359894e1a1a2e81289342a776309dcf6fbd0b8bebed92e84dfc7237d0452
)

Open in new window

Avatar of BR

ASKER

Thank you Ray Paseur,
Do I expect to receive more than one TRANSACTION in each call to the API? the answer is NO
I would expect only one.
OK, I have the docs.  I don't think there is anything secret in there :-)  

Have you thought about your database structure enough to have your CREATE TABLE statements for the tables?
Avatar of BR

ASKER

if I can get the data, and assign it to a variable, it is easy to create a table and insert the data to my database...
thank you.

How can I pars and assign the input into my variables?
I'll show you how to parse it as I get the data decoded and I get an understanding of what the payment gateway sent back to you.  It looks like the JSON representation is described on page 31, and the acknowledgement handshake is described on page 33.  We talked about the acknowledgement in another question earlier.

Can you tell me what format you used for the request to the payment gateway?  Was it XML, JSON, etc?
Avatar of BR

ASKER

I simply post the data with php and html.
I used hidden inputs. Like this

 <input type="hidden" name="USER.VERIFY" value="3" />
<input type="hidden" name="USER.ID" value="2" />

please acknowledge that, it works perfectly fine,
I only don't know how to get the results strings...
OK, that's helpful.  I'm still reading (50 pages!) so it will take me a little longer...
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

Dear Ray,
I don't know how to thank you. You are the BEST.
Avatar of Julian Hansen
What is interesting about this is that the data appears to contain an array of objects encoded in URL format - which is going to confuse PHP.

Is it not possible to ask the gateway to send JSON - then you can take your RAW input (php://input) and simply feed it into json_decode()

$raw = file_get_contents('php://input');
$json = json_decode($raw);

Open in new window

Now you have an object you can work with. Ray's approach will get you half way there but you will have to start interpreting the following
    [TRANSACTION[0].COMMRATE] => 2,3000
    [TRANSACTION[0].COMMTYPEID] => 10
    [TRANSACTION[0].ID] => 328
    [TRANSACTION[0].INST] => 1
    [TRANSACTION[0].CARDBRAND] => 20
    [TRANSACTION[0].VPOSID] => 6
    [TRANSACTION[0].VPOSAPIID] => 80
    [TRANSACTION[0].PAYSETID] => 7
    [TRANSACTION[0].PAYSETNAME] => NKolayDepo
    [TRANSACTION[0].PINST] => 0
    [TRANSACTION[0].PDEFER] => 0
    [TRANSACTION[0].REFERENCE] => NT40642P0000000328
    [TRANSACTION[0].ISTEST] => False
    [TRANSACTION[0].DETAIL[0].ID] => 482
    [TRANSACTION[0].DETAIL[0].AMOUNT] => 1,00
    [TRANSACTION[0].DETAIL[0].DATETIME] => 2017-04-25 12:28:37Z
    [TRANSACTION[0].DETAIL[0].ERROR] => {}
    [TRANSACTION[0].DETAIL[0].NETAMOUNT] => 0,98
    [TRANSACTION[0].DETAIL[0].STATUS] => 1
    [TRANSACTION[0].DETAIL[0].TYPE] => 40

Open in new window

Which is going to take a bit of coding - I don't have the doc you shared with Ray but if it allows for a JSON return then I would go with that.
@Julian: The docs seem to suggest that you can speak to the API with a POST-method request via an HTML form, JSON, or XML.  The information you see here came to us as a response to the HTML form request.  It was not clear to me how to get a JSON or XML response, and the manual is 50 pages long, so I just worked with what we have.  The output is an associative array, suitable as an intermediate step between the API response and a query string.  This is probably in need of sanity checks, etc.  Also, the information in the API response is URL-encoded twice, an oddity that makes me think this API might not be quite ready for "prime time" yet.

Here is where we are, so far: https://iconoun.com/demo/temp_braveheartli.php
Outputs
RESPONSE.DATETIME=2017-04-25 09:28:59Z&RESPONSE.ID=260&ORDER.REFERENCE=svoO75UABHdvh1lkHq5R2U9i10qTKlJI90v5ZJcVW0&ORDER.DATETIME=2017-04-25 12:28:57Z&ORDER.CUSTOMREFERENCE=webmaster&REQUEST.ID=317&REQUEST.STATUSID=20&REQUEST.ERROR={}&TRANSACTION[0].COMMRATE=2,3000&TRANSACTION[0].COMMTYPEID=10&TRANSACTION[0].ID=328&TRANSACTION[0].INST=1&TRANSACTION[0].CARDBRAND=20&TRANSACTION[0].VPOSID=6&TRANSACTION[0].VPOSAPIID=80&TRANSACTION[0].PAYSETID=7&TRANSACTION[0].PAYSETNAME=NKolayDepo&TRANSACTION[0].PINST=0&TRANSACTION[0].PDEFER=0&TRANSACTION[0].REFERENCE=NT40642P0000000328&TRANSACTION[0].ISTEST=False&TRANSACTION[0].DETAIL[0].ID=482&TRANSACTION[0].DETAIL[0].AMOUNT=1,00&TRANSACTION[0].DETAIL[0].DATETIME=2017-04-25 12:28:37Z&TRANSACTION[0].DETAIL[0].ERROR={}&TRANSACTION[0].DETAIL[0].NETAMOUNT=0,98&TRANSACTION[0].DETAIL[0].STATUS=1&TRANSACTION[0].DETAIL[0].TYPE=40&HASH=e5ba359894e1a1a2e81289342a776309dcf6fbd0b8bebed92e84dfc7237d0452Array
(
    [RESPONSE_DATETIME] => 2017-04-25 09:28:59Z
    [RESPONSE_ID] => 260
    [ORDER_REFERENCE] => svoO75UABHdvh1lkHq5R2U9i10qTKlJI90v5ZJcVW0
    [ORDER_DATETIME] => 2017-04-25 12:28:57Z
    [ORDER_CUSTOMREFERENCE] => webmaster
    [REQUEST_ID] => 317
    [REQUEST_STATUSID] => 20
    [REQUEST_ERROR] => 
    [TRANSACTION_COMMRATE] => 2,3000
    [TRANSACTION_COMMTYPEID] => 10
    [TRANSACTION_ID] => 328
    [TRANSACTION_INST] => 1
    [TRANSACTION_CARDBRAND] => 20
    [TRANSACTION_VPOSID] => 6
    [TRANSACTION_VPOSAPIID] => 80
    [TRANSACTION_PAYSETID] => 7
    [TRANSACTION_PAYSETNAME] => NKolayDepo
    [TRANSACTION_PINST] => 0
    [TRANSACTION_PDEFER] => 0
    [TRANSACTION_REFERENCE] => NT40642P0000000328
    [TRANSACTION_ISTEST] => False
    [TRANSACTION_DETAIL_ID] => 482
    [TRANSACTION_DETAIL_AMOUNT] => 1,00
    [TRANSACTION_DETAIL_DATETIME] => 2017-04-25 12:28:37Z
    [TRANSACTION_DETAIL_ERROR] => 
    [TRANSACTION_DETAIL_NETAMOUNT] => 0,98
    [TRANSACTION_DETAIL_STATUS] => 1
    [TRANSACTION_DETAIL_TYPE] => 40
    [HASH] => e5ba359894e1a1a2e81289342a776309dcf6fbd0b8bebed92e84dfc7237d0452
)

Open in new window

Is the doc available? What you have can work just interested to see why they have done it this way. Seems like they did a JSON return and then tried to retro fit it to a URL string
Avatar of BR

ASKER

@Julian hi,
I can send you the documents tomorrow if you are interested
I am curious - can't promise anything though.
Avatar of BR

ASKER

Thank you Julian, I'm not expecting anything, i will send the documents just because you wanted to see it, that's all. Please don't waste your time on it. Thank's to Ray, we did a lot on it. Tomorrow i will have a new question though :)
I have had a look through the document and all I can see is JSON and XML responses - how are you interacting with the site such that you are getting the response that you are getting?

If I look on page 26 of the doc I see
Using JSON 
The JSON, which will be sent to shop site is created as follows.

{
    "Response": {
        "Id": 18,
        "DateTime": "2012-09-24 15:04:02Z"
    },
    "Order": {
        "Reference": "021983421908",
        "DateTime": "2012-09-24 17:56:09Z"
    },
    "Request": {
        "Id": 30,
        "StatusId": 30,
        "Error": {
            "Code": "ParameterValidationError",
            "Message": "Item[0].Id parameter is invalid.",
            "ExtraData": [{ "Name": "Item[0].Id", "Value": "HARC13" }]
        }
    }
}

Open in new window


Which looks like the response you are getting - but in JSON format.
And on page 31 you have the following which contains the transaction record
Using JSON 
The JSON, which will be sent to shop site is created as follows.

{
    "Response": { 
        "Id": 29, 
        "DateTime": "2012-09-25 09:15:28Z"
    },
    "Order": {
        "Reference": "KUN46DS65TG78H65", 
        "DateTime": "2012-09-25 12:12:53Z"
    },
    "Request": {
        "Id": 42,
        "StatusId": 30
    },
    "Transactions": [{
            "Id": 301,
            "Reference": "NTXYZSTE11123P0000000301",
            "VPosId": 3, 
            "PaymentSetId": 1,
            "PaySetName": "Default",
            "Installment": 1,
            "PlusInstallment": 0,
            "CommTypeId": 20, 
            "CommRate": "1.0203",
            "Detail": [{
                            "Id": 360,
                            "Success": 1,
                            "Type": 40,
                            "DateTime": "2012-09-25 09:15:23Z",
                            "Amount": "1.01",
                            "NetAmount": "1.00" 
                    }]
    }]
}

Open in new window


On page 17 there is this

Using JSON Format
You should post all of your data to https://paymentsite.netahsilatdemo.com/hpm/json

Open in new window


What I read from this is if you send the data to the /json end point you will get JSON back.
Avatar of BR

ASKER

Dear Julian,
thank you, So do you recommend to post the data in Json format and get back the data in Json format?
Thank's to Ray, Everything works now. I get everything I need up to now.
Yes - that would make your life a lot easier. You will still need to urldecode the results it seems - but the resulting string can be fed into json_decode() which will give you an object.

Transaction data would then be retrieved like this
$raw = file_get_contents("php://input");
$json = json_decode(urldecode($raw));

Open in new window

With input
$raw = '%7B%0A%20%20%20%20%22Response%22%3A%20%7B%20%0A%20%20%20%20%20%20%20%20%22Id%22%3A%2029%2C%20%0A%20%20%20%20%20%20%20%20%22DateTime%22%3A%20%222012-09-25%2009%3A15%3A28Z%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22Order%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Reference%22%3A%20%22KUN46DS65TG78H65%22%2C%20%0A%20%20%20%20%20%20%20%20%22DateTime%22%3A%20%222012-09-25%2012%3A12%3A53Z%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22Request%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Id%22%3A%2042%2C%0A%20%20%20%20%20%20%20%20%22StatusId%22%3A%2030%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22Transactions%22%3A%20%5B%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Id%22%3A%20301%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Reference%22%3A%20%22NTXYZSTE11123P0000000301%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22VPosId%22%3A%203%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%22PaymentSetId%22%3A%201%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22PaySetName%22%3A%20%22Default%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Installment%22%3A%201%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22PlusInstallment%22%3A%200%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22CommTypeId%22%3A%2020%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%22CommRate%22%3A%20%221.0203%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Detail%22%3A%20%5B%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Id%22%3A%20360%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Success%22%3A%201%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Type%22%3A%2040%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22DateTime%22%3A%20%222012-09-25%2009%3A15%3A23Z%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Amount%22%3A%20%221.01%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22NetAmount%22%3A%20%221.00%22%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%5D%0A%20%20%20%20%7D%5D%0A%7D';

Open in new window

This should give output like so
stdClass Object
(
    [Response] => stdClass Object
        (
            [Id] => 29
            [DateTime] => 2012-09-25 09:15:28Z
        )

    [Order] => stdClass Object
        (
            [Reference] => KUN46DS65TG78H65
            [DateTime] => 2012-09-25 12:12:53Z
        )

    [Request] => stdClass Object
        (
            [Id] => 42
            [StatusId] => 30
        )

    [Transactions] => Array
        (
            [0] => stdClass Object
                (
                    [Id] => 301
                    [Reference] => NTXYZSTE11123P0000000301
                    [VPosId] => 3
                    [PaymentSetId] => 1
                    [PaySetName] => Default
                    [Installment] => 1
                    [PlusInstallment] => 0
                    [CommTypeId] => 20
                    [CommRate] => 1.0203
                    [Detail] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [Id] => 360
                                    [Success] => 1
                                    [Type] => 40
                                    [DateTime] => 2012-09-25 09:15:23Z
                                    [Amount] => 1.01
                                    [NetAmount] => 1.00
                                )

                        )

                )

        )

)

Open in new window

Which you can now access like so
echo $json->Transactions[0]->Detail[0]->DateTime;

Open in new window

Avatar of BR

ASKER

Thank you Julian,
I will try it with JSON format too. I will let you know. Thank you so much