Bonjour,
j'ai un problème sur un serveur avec la fonction arrays_key() sur un serveur windows.
La fonction me retourne une erreur 500.
Je ne vois pas où est l'erreur car en plus, ça marche en local.
Explication:
J'envoie via curl du json et dans une page, je récupère le contenu et le traite.
Voici le code qui envoie le json.
<?php
$ch = curl_init();
$post='{"apikey":"BUS",
"transaction":[{"IDTRANSACTION":12,"PERMANENTID":"DUA0000000012","OwnerCompanyID":"SLT","SS_FriendlyID":"3501","Ticket_Count":1,"ISACTIVE":1,"Cust_FriendlyID":"2","Offering_FriendlyID":"2J PT","CASHIER_ID":"0","IDPERSON":991,"TicketNumber":"TKBTOE41783","RelatedTicketNumber":"","TR_Cart":"TKBTOE","CUrrency_ISOCODE":"EUR","Amount":36,"BEFORETAXAMOUNT":30,"TR_Type":"SALE","TR_TypeDetail":"STANDARD","TR_DebitCredit":"CREDIT","TR_DateTime":"20140224163710000","TR_Status":"CONFIRMED","TR_TaxCode1":"VYU0000000653","TR_TaxCode2":"VYU0000001004","ISDeleted":0,"TR_SalesChannelCode":"313","GroupID":"SLT","TR_DueDateTime":"20140226","BUS_ID":"21","Cust_Type":"","SS_ColorCode1":"GREEN","SS_ColorCode2":"","TR_StopCode":"","TR_LIneName":"","TR_OfferingTitle":"2 jours plein tarif","TR_Quantity":1,"TR_PaymentModeTitle":"","TR_COMMENT":"","ISTRANSFER":0,"ISADJUSTINGENTRY":0},
{"IDTRANSACTION":13,"PERMANENTID":"DUA0000000013","OwnerCompanyID":"SLT","SS_FriendlyID":"3501","Ticket_Count":1,"ISACTIVE":1,"Cust_FriendlyID":"2","Offering_FriendlyID":"2J PT","CASHIER_ID":"0","IDPERSON":991,"TicketNumber":"TKBTOE59119","RelatedTicketNumber":"","TR_Cart":"TKBTOE","CUrrency_ISOCODE":"EUR","Amount":36,"BEFORETAXAMOUNT":30,"TR_Type":"SALE","TR_TypeDetail":"STANDARD","TR_DebitCredit":"CREDIT","TR_DateTime":"20140224163710000","TR_Status":"CONFIRMED","TR_TaxCode1":"VYU0000000653","TR_TaxCode2":"VYU0000001004","ISDeleted":0,"TR_SalesChannelCode":"313","GroupID":"SLT","TR_DueDateTime":"20140226","BUS_ID":"21","Cust_Type":"","SS_ColorCode1":"GREEN","SS_ColorCode2":"","TR_StopCode":"","TR_LIneName":"","TR_OfferingTitle":"2 jours plein tarif","TR_Quantity":1,"TR_PaymentModeTitle":"","TR_COMMENT":"","ISTRANSFER":0,"ISADJUSTINGENTRY":0},
{"IDTRANSACTION":14,"PERMANENTID":"DUA0000000014","OwnerCompanyID":"SLT","SS_FriendlyID":"3501","Ticket_Count":1,"ISACTIVE":0,"Cust_FriendlyID":"2","Offering_FriendlyID":"","CASHIER_ID":"0","IDPERSON":991,"TicketNumber":"TKBTOE55118","RelatedTicketNumber":"","TR_Cart":"TKBTOE","CUrrency_ISOCODE":"EUR","Amount":72,"BEFORETAXAMOUNT":72,"TR_Type":"PAYMENT","TR_TypeDetail":"CASH","TR_DebitCredit":"DEBIT","TR_DateTime":"20140224163710000","TR_Status":"CONFIRMED","TR_TaxCode1":"VYU0000000653","TR_TaxCode2":"VYU0000001004","ISDeleted":0,"TR_SalesChannelCode":"313","GroupID":"SLT","TR_DueDateTime":"20140226","BUS_ID":"21","Cust_Type":"","SS_ColorCode1":"GREEN","SS_ColorCode2":"","TR_StopCode":"","TR_LIneName":"","TR_OfferingTitle":"Paiement Espèces","TR_Quantity":1,"TR_PaymentModeTitle":"Paiement Espèces","TR_COMMENT":"","ISTRANSFER":0,"ISADJUSTINGENTRY":0}]}';
$post=json_encode(json_decode($post));
$arr = array();
array_push($arr, 'Content-Type: application/json; charset=utf-8');
curl_setopt($ch, CURLOPT_HTTPHEADER, $arr);
curl_setopt($ch, CURLOPT_URL, 'http://localhost/transaction.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
curl_exec($ch);
curl_close($ch);
?>
Et voici le code qui récupère le json (transaction.php).
$count=count($json['transaction']);
$chjson="";
//echo "transaction";
for ($n = 0; $n <$count; $n++)
{
$transaction = $json['transaction'][$n];
$cles=array_keys( $transaction);
$i=0;
foreach ($transaction as $v)
{
$chjson=$chjson.$cles[$i]."##". $v."#RC#";
$i++;
}
$chjson=$chjson."#FIN#";
}
Merci d'avance pour votre aide.