1

I need to convert Edifact messages to a PHP array. The message standard which should be supported is MEDVRY.

How to program that?

Sarah
  • 281
  • 3
  • 7
  • 13
  • 1
    What exactly do you want? A recipe for EDIFACT to PHP array or advice on how to tackle the problem. Secondly how well do you know EDIFACT and how much PHP programming have you done? I cannot write the programme for you but i can give you a step by step as to how to tackle the problem. – PurplePilot Jan 07 '11 at 19:10
  • I was about to answer your question when I realized that "MEDVRY" does not sound familiar to me. I went to the list of standard - http://live.unece.org/trade/untdid/d10b/trmd/trmdi1.htm - and actually did not find "MEDVRY" :-/ Did you make a typo? What's an "MEDVRY"? Do you have a sample instance? – Babelabout Jun 22 '11 at 06:16

2 Answers2

3

I'm the author of the class used by @Thomas1703 (https://github.com/sabas/Edifact), I've updated the code recently because I found some bugs in the regexes. Currently handles probably all the needs (wrapped messages) and does a bit of validation before returning the array.

sabas
  • 743
  • 8
  • 18
  • 2
    This should probably be posted as a comment to @Thomas1703's answer rather than an answer of its own. – rjp Jun 19 '14 at 14:00
  • 1
    I know, but I don't have rights to do it currently. – sabas Jun 23 '14 at 09:37
  • Hey sabas! i know this is a super old post but. When using your Reader class. How do you tell the method readEdiDataValue to get a response if there's more than one key specified in the edi file?. If i try to call the method like this: $reader->readEdiDataValue('NAD', 1); It returns NULL because in the file exists NAD+CA and NAD+FW. How can i send NAD as param and get all matches as return? – SpicyTacos23 Apr 22 '21 at 13:14
  • @SpicyTacos23 can you file an issue in the Github repository? I didn't implement that class, so I'm not sure how to respond to your problem... Thanks! – sabas Apr 22 '21 at 18:01
1

i use this class: https://github.com/sabas/Edifact/blob/master/class.EDIParser.php

$c=new EDIParser('name.edi');
//Output a multidimensional array.
//Errors $c->errors()
//Array $c->get()
//Json $c->getJson()
Thomas1703
  • 1,152
  • 5
  • 16
  • 33