Jump to content

Recommended Posts

hi, i have a problem i devolped a php code that reads a strange type of files and extracts me some line that i can import in a mariaDB database.

But my problem is in a prove of concept i saw that only one line textlines will show/import to the db, more textlines not...

Here is the file for example:

cnotr��1Љ�� ���3��
To-Do List ADD88FFD4B051726FAD4D8BECC5EB35FA1��1Љ��Case file newly created. 93B31E2B420ED4EC5A83AF62E8AC3972A1��1Љ���Case file MetaData defined as follows:
    Case status flag: 0
    Tab One:
    Tab Two:
    Tab Three:
    Tab Four:
\li5\ul\b\f99 27.06.2016 12:52:47\ulnone\b0\par
\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\b\f0\fs24 TEXTLINE \par
}
 707709FCB433F3AC5494CD431EB71E4EA1�ya����SNew contemporaneous case note entered.
Hash value: 707709FCB433F3AC5494CD431EB71E4E B163DC79E3E0EA755AAA1371291C16DCA1 j\��)User Tab data updated for 'Exhibit List'. DAAD1C58C61F20E88EDC1F1382D5B899A1 j\��'User Tab data updated for 'To-Do List'. 2063A822C77EFDC66A45FD6F4E8C403CA1 j\��Case file saved. 80B9EFD9F57247EB3173E5A83F73E15FA1 ľ����$
08D062DA12D76C61A1A302C5D7F14D90A1�K�[���)User Tab data updated for 'Exhibit List'. DAAD1C58C61F20E88EDC1F1382D5B899A1�K�[���'User Tab data updated for 'To-Do List'. 2063A822C77EFDC66A45FD6F4E8C403CA1�K�[���Case file saved. 80B9EFD9F57247EB3173E5A83F73E15FA1 }^�3��@All Hash values match
\li5\ul\b\f99 01.00.1970 00:00:00\ulnone\b0\par
\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\f0\fs20 TEXTLINE \par
TEXTLINE2.\par
TEXTLINE3.\par
TEXTLINE4.\par
}
 FB6537240A6A8A01282605B15C5F1ED4A1 ���3��SNew contemporaneous case note entered.
Hash value: FB6537240A6A8A01282605B15C5F1ED4 581DC665C1E202B1A102DE1D6119DE61A1 A�4��$Case data sent to printer:
08D062DA12D76C61A1A302C5D7F14D90A1���44��)User Tab data updated for 'Exhibit List'. DAAD1C58C61F20E88EDC1F1382D5B899A1���44��'User Tab data updated for 'To-Do List'. 2063A822C77EFDC66A45FD6F4E8C403CT1�{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\ul\b\f0\fs20 Exhibit List\par
\par
\ulnone\b0\f1\par
}
T2�{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\ul\b\f0\fs20 To-Do List\par
\par
\ulnone\b0\f1\par
}
A1���44��80B9EFD9F57247EB3173E5A83F73E15F D594DED1762AE378561E47F36AB54F3Ecnotr��1Љ�� ���3��
To-Do List ADD88FFD4B051726FAD4D8BECC5EB35FA1��1Љ��Case file newly created. 93B31E2B420ED4EC5A83AF62E8AC3972A1��1Љ���Case file MetaData defined as follows:
    Case status flag: 0
    Tab One:
    Tab Two:
    Tab Three:
    Tab Four:
\li5\ul\b\f99 27.06.2016 12:52:47\ulnone\b0\par
\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\b\f0\fs24 TEXTLINE \par
}
 707709FCB433F3AC5494CD431EB71E4EA1�ya����SNew contemporaneous case note entered.
Hash value: 707709FCB433F3AC5494CD431EB71E4E B163DC79E3E0EA755AAA1371291C16DCA1 j\��)User Tab data updated for 'Exhibit List'. DAAD1C58C61F20E88EDC1F1382D5B899A1 j\��'User Tab data updated for 'To-Do List'. 2063A822C77EFDC66A45FD6F4E8C403CA1 j\��Case file saved. 80B9EFD9F57247EB3173E5A83F73E15FA1 ľ����$
08D062DA12D76C61A1A302C5D7F14D90A1�K�[���)User Tab data updated for 'Exhibit List'. DAAD1C58C61F20E88EDC1F1382D5B899A1�K�[���'User Tab data updated for 'To-Do List'. 2063A822C77EFDC66A45FD6F4E8C403CA1�K�[���Case file saved. 80B9EFD9F57247EB3173E5A83F73E15FA1 }^�3��@All Hash values match
\li5\ul\b\f99 01.00.1970 00:00:00\ulnone\b0\par
\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\f0\fs20 TEXTLINE \par
TEXTLINE2.\par
TEXTLINE3.\par
TEXTLINE4.\par
}
 FB6537240A6A8A01282605B15C5F1ED4A1 ���3��SNew contemporaneous case note entered.
Hash value: FB6537240A6A8A01282605B15C5F1ED4 581DC665C1E202B1A102DE1D6119DE61A1 A�4��$Case data sent to printer:
08D062DA12D76C61A1A302C5D7F14D90A1���44��)User Tab data updated for 'Exhibit List'. DAAD1C58C61F20E88EDC1F1382D5B899A1���44��'User Tab data updated for 'To-Do List'. 2063A822C77EFDC66A45FD6F4E8C403CT1�{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\ul\b\f0\fs20 Exhibit List\par
\par
\ulnone\b0\f1\par
}
T2�{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\ul\b\f0\fs20 To-Do List\par
\par
\ulnone\b0\f1\par
}
A1���44��80B9EFD9F57247EB3173E5A83F73E15F D594DED1762AE378561E47F36AB54F3E

 

And here is my code (cut for that example):

 <?php
$file=file("test.txt");
$date = array();
$text = array();
foreach ($file as $line) {
if (strpos($line, "f99 ") !== false) {
$date[] = substr($line, strpos($line, "\li5\ul\b\f99 ") + 14, 19);
}
if (strpos($line, "\\viewkind4\\uc1\\pard") !== false) {
if (str_contains($line, "Exhibit List")) {
echo "<b>HINWEIS: Exhibit List</b>";
echo "<br>";
} elseif (str_contains($line, "To-Do List")) {
echo "<b>HINWEIS: To-Do List</b>";
echo "<br>";
} else {
$text[] = substr($line, strpos($line, "\viewkind4\uc1\pard") + 27, -6);
}
}
}
var_dump($date);
var_dump($text);
?> 

 

 

You can copy that and runs that example completly.

 

For now i get this:

01.00.1970 00:00:00
TEXTLINE

02.00.1970 00:00:00
TEXTLINE

 

But i want that:

01.00.1970 00:00:00
TEXTLINE

02.00.1970 00:00:00
TEXTLINE
TEXTLINE2
TEXTLINE3
TEXTLINE4

 

Thank you for any help :)

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.