Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo '<pre>';
- //$html = $_POST['volvodom'];
- $html = file_get_contents('textfan.txt');
- $content_match = '/ctl00_MasterContentForm_Panel3(.*?)ctl00_MasterContentForm_Q3ErrorInfo/';
- preg_match($content_match, $html, $content);
- //echo $content[0];
- $sales = array(
- 'full_interviews' => '/<td style="word-wrap:break-word;font-style:normal;font-family:Arial;font-size:8pt;font-weight:700;text-decoration:none;unicode-bidi:normal;color:Black;direction:ltr;layout-flow:horizontal;writing-mode:lr-tb;vertical-align:middle;">(.*?)<\/td>/',
- 'full_interviews_title' => '/<td style="word-wrap:break-word;font-style:italic;font-family:Arial;font-size:7pt;font-weight:400;text-decoration:none;unicode-bidi:normal;color:Black;direction:ltr;layout-flow:horizontal;writing-mode:lr-tb;vertical-align:middle;">(.*?[^<]*)<\/td>/',
- 'title' => '/<td style="word-wrap:break-word;font-style:italic;font-family:Arial;font-size:8pt;font-weight:400;text-decoration:none;unicode-bidi:normal;color:Black;direction:ltr;layout-flow:horizontal;writing-mode:lr-tb;vertical-align:middle;">(.*?[^<]*)<\/td>/',
- 'number' => '/<span style="font-family:Arial;font-size:8pt;font-weight:700;font-style:normal;text-decoration:none;color.*?;">(.*?)<\/span>/',
- );
- $leftData = array();
- $rightData = array();
- $titles = array();
- $numbers = array();
- foreach ($sales as $key => $match)
- {
- if (preg_match_all($match, $content[0], $results))
- {
- if ($key == 'title') $titles = $results[0];
- else $numbers = $results[0];
- print_r($results[0]);
- }
- }
- foreach ($titles as $nr => $field)
- {
- if ($nr > 3) $rightData[$field] = $numbers[$nr];
- else $leftData[$field] = $numbers[$nr];
- }
- print_r($leftData);
- print_r($rightData);
Add Comment
Please, Sign In to add comment