Guest User

Untitled

a guest
Jun 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. <?php
  2. echo '<pre>';
  3. //$html = $_POST['volvodom'];
  4. $html = file_get_contents('textfan.txt');
  5.  
  6. $content_match = '/ctl00_MasterContentForm_Panel3(.*?)ctl00_MasterContentForm_Q3ErrorInfo/';
  7. preg_match($content_match, $html, $content);
  8. //echo $content[0];
  9.  
  10. $sales = array(
  11.     '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>/',
  12.     '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>/',
  13.     '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>/',
  14.     'number' => '/<span style="font-family:Arial;font-size:8pt;font-weight:700;font-style:normal;text-decoration:none;color.*?;">(.*?)<\/span>/',
  15. );
  16. $leftData  = array();
  17. $rightData = array();
  18. $titles    = array();
  19. $numbers   = array();
  20. foreach ($sales as $key => $match)
  21. {
  22.     if (preg_match_all($match, $content[0], $results))
  23.     {
  24.         if ($key == 'title') $titles  = $results[0];
  25.         else                 $numbers = $results[0];
  26.         print_r($results[0]);
  27.     }
  28. }
  29.  
  30. foreach ($titles as $nr => $field)
  31. {
  32.     if ($nr > 3) $rightData[$field] = $numbers[$nr];
  33.     else         $leftData[$field] = $numbers[$nr];
  34. }
  35.  
  36. print_r($leftData);
  37. print_r($rightData);
Add Comment
Please, Sign In to add comment