EDI X.12 PHP Mapping - Resources Required

Are there any php libraries or APIs that help when working with X12 documents in php? Googling doesn't help much, so you're looking for people with experience in the field.

+2


source to share


3 answers


While doing a quick Google search, I found several tools that convert X12 documents to XML. PHP has made significant advances in XML parsing.



Is converting to XML the first option?

+1


source


If you know which segments and what value are in all segments. Then its just about php

$file = file_get_contents('/edi.x12');
$segments = explode(~\n,$file);
foreach($segments as $segment){

$elements = explode('*',$segment);

foreach($elements as $element){

     switch($elements[0]){
          case 'ISA':
              break;
     /// And so on
}
}
}

      

Then you will have an array consisting of all the segments in the file. If you just iterate over the array, you can get all the elements for a given segment.



But for creating x12 Edi file it is a little more complicated.

I don't see the point in the first conversion to Xml.

+4


source


not PHP, but python: http://bots.sourceforge.net translates from and to x12.

+1


source







All Articles