I am trying to show a selection of transactions using PHP and Paypal's NVP TransactionSearch method.
I successfully get the transactions to appear but i cannot tidy the response up and show only the specific values i am after - in this case being just the following 4 values per transaction:
L_TIMESTAMP,
L_TYPE,
L_TRANSACTIONID
My current code is:
$request = http_build_query(array(
"METHOD" => $action,
"VERSION" => $config['version'],
"USER" => $config['username'],
"PWD" => $config['password'],
"SIGNATURE" => $config['signature'],
"STARTDATE" => $start,
"EMAIL" => $email,
));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$result = curl_exec($ch);
if (!$result) {
echo 'no results';
}
parse_str($result, $result);
foreach($result as $key => $value){
echo $key.' => '.$value."<br />";
}
which outputs everything in one as below :
L_TIMESTAMP0 => 2014-01-15T11:29:21Z
L_TIMESTAMP1 => 2014-01-15T11:09:05Z
L_TIMEZONE0 => GMT
L_TIMEZONE1 => GMT
L_TYPE0 => Refund
L_TYPE1 => Payment
L_TRANSACTIONID0 => 7MY22222222222914
L_TRANSACTIONID1 => 2045555555555594D
and so on...
How can i instead output it like this: (so it goes through each transaction then the next rather than each 'value' and onto the next, plus not show the TIMEZONE key)
L_TIMESTAMP0 => 2014-01-15T11:29:21Z
L_TYPE0 => Refund
L_TRANSACTIONID0 => 7MY22222222222914
L_TIMESTAMP1 => 2014-01-15T11:09:05Z
L_TYPE1 => Payment
L_TRANSACTIONID1 => 2045555555555594D
$resultlook like before you runparse_strarray_filter()parse_strfrom the above code i get nothing outputted on the page