|  | how can I trun this into array? |  | |
| | | TriAdmin |  |
| Posted: Sat Aug 30, 2008 4:44 pm Post subject: how can I trun this into array? |  |
The return from a curl() cal is:https_Ordernumber=https_card_number=**************https_exp_date=1218https_amount=40.54https_customer_code=https_salestax=https_result=8https_result_message=NOT APPROVEDhttps_txn_id=sjhdkjhskjdhkjhkjh2kj3h2kj389723ihjk2h3https_approval_code=W837267671https_cvv2_response=https_account_balance=0.00https_txn_time=08/30/2008 02:32:52 PMI need to get the variable "https_result" so I thought I could put it in an array and then call it. I've tried (note aboce that some variables are blank) :$pieces = explode(" ", $result);but it doesn't work as hoped. I've tried:$pieces = explode("=", $result);but not working as hoped.Any ideas? |
| |
| | | Olaf Schinkel |  |
| Posted: Sat Aug 30, 2008 5:16 pm Post subject: Re: how can I trun this into array? |  |
TriAdmin schrieb:
| Quote: | The return from a curl() cal is:https_Ordernumber=https_card_number=**************https_exp_date=1218https_amount=40.54https_customer_code=https_salestax=https_result=8https_result_message=NOT APPROVEDhttps_txn_id=sjhdkjhskjdhkjhkjh2kj3h2kj389723ihjk2h3https_approval_code=W837267671https_cvv2_response=https_account_balance=0.00https_txn_time=08/30/2008 02:32:52 PMI need to get the variable "https_result" so I thought I could put it in an array and then call it. I've tried (note aboce that some variables are blank) :$pieces = explode(" ", $result);but it doesn't work as hoped. I've tried:$pieces = explode("=", $result);but not working as hoped.Any ideas?
why not |
$pieces = explode("https_", $result);
for test: print_r($pieces);
? |
| |
| | | TriAdmin |  |
| Posted: Sat Aug 30, 2008 5:31 pm Post subject: Re: how can I trun this into array? |  |
| |  | |
"Olaf Schinkel" <trash@schinkel.tv> wrote in message news:48b99ca4$0$12940$9b4e6d93@newsspool2.arcor-online.net...
| Quote: | TriAdmin schrieb: The return from a curl() cal is:https_Ordernumber=https_card_number=**************https_exp_date=1218https_amount=40.54https_customer_code=https_salestax=https_result=8https_result_message=NOT APPROVEDhttps_txn_id=sjhdkjhskjdhkjhkjh2kj3h2kj389723ihjk2h3https_approval_code=W837267671https_cvv2_response=https_account_balance=0.00https_txn_time=08/30/2008 02:32:52 PMI need to get the variable "https_result" so I thought I could put it in an array and then call it. I've tried (note aboce that some variables are blank) :$pieces = explode(" ", $result);but it doesn't work as hoped. I've tried:$pieces = explode("=", $result);but not working as hoped.Any ideas? why not $pieces = explode("https_", $result);
for test: print_r($pieces);
?
|
thanks. that works part wise but there is another piece I di dnot add - when it throws an error, the https_ variables are not part of the returned value.
How ever, I think I can work my way through this - thanks |
| |
| | | nice.guy.nige |  |
| Posted: Sat Aug 30, 2008 5:59 pm Post subject: Re: how can I trun this into array? |  |
While the city slept, TriAdmin feverishly typed:
| Quote: | thanks. that works part wise but there is another piece I di dnot add - when it throws an error, the https_ variables are not part of the returned value.
How ever, I think I can work my way through this - thanks
|
Off the top of my head...
$string = "https_blah_etc.....";
$split = explode("https_", $string); if($split[0] != $string) { // explode returns the whole string if delimiter not found, so something is here } else { // no https_'s }
Like I say, straight off the top of my head... off for beer now...
Cheers, Nige
-- Nigel Moss | LINK Email not valid. nigel@dog.nigenet.org.uk - take the dog out! "You're mother ate my dog!", "Not all of him..." |
| |
| | | TriAdmin |  |
| Posted: Sun Aug 31, 2008 12:30 pm Post subject: Re: how can I trun this into array? |  |
| |  | |
"nice.guy.nige" <nigel_moss@deadspam.com> wrote in message news:6htn5tFo2hb1U1@mid.individual.net...
| Quote: | While the city slept, TriAdmin feverishly typed:
thanks. that works part wise but there is another piece I di dnot add - when it throws an error, the https_ variables are not part of the returned value.
How ever, I think I can work my way through this - thanks
Off the top of my head...
$string = "https_blah_etc.....";
$split = explode("https_", $string); if($split[0] != $string) { // explode returns the whole string if delimiter not found, so something is here } else { // no https_'s }
Like I say, straight off the top of my head... off for beer now...
Cheers, Nige
-- Nigel Moss | LINK Email not valid. nigel@dog.nigenet.org.uk - take the dog out! "You're mother ate my dog!", "Not all of him..."
|
Ah hah - the ol' double split(), good thinking. thanks - I dig your web site also. I like when good people don't take themselves very seriously. |
| |
|
|