You are here:  » MagicParser_getFormat()


Autodetect the data representation format of just about any XML or CSV variant text file


string MagicParser_getFormat ( string filename )

MagicParser_getFormat() attempts to automatically detect the file type and data representation format of filename, returning a format string that may be used in calls to MagicParser_parse() for the same file. filename can be anything that would be used with PHP's fopen() function, including Internet URLs if URL wrappers are enabled.

Return Value

If autodetection is successful, MagicParser_getFormat() returns the format string as described in the format string specification section. An empty string indicates that an error occurred. Use MagicParser_getErrorMessage() to determine the cause of the problem.