thieumao

Dang Code

Mar 28th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.87 KB | None | 0 0
  1.     $linkTySo=$Link;
  2.     $html = file_get_html($linkTySo);
  3.     //table  class="match-details match-ellipsis league-table mtn"
  4.     foreach($html->find('table[class="match-details match-ellipsis league-table mtn"]') as $e) {
  5.         $chtml =  str_get_html($e->innertext);
  6.         break;
  7.     }
  8.  
  9.     $i=0;
  10.     foreach($chtml->find('span[class="team"]') as $e) {
  11.         $i++;
  12.         if ($i==1){
  13.             $Doi1 = trim($e->plaintext);
  14.         }
  15.         if ($i==2){
  16.             $Doi2 = trim($e->plaintext);
  17.             break;
  18.         }
  19.     }
  20.     $i=0;
  21.     foreach($chtml->find('tr') as $e) {
  22.         $Phut = "";
  23.         $TySo = "";
  24.         $CauThu1 = "";
  25.         $CauThu2 = "";
  26.         $Bong1 = 0;
  27.         $Bong2 = 0;
  28.         $Vang1 = 0;
  29.         $Vang2 = 0;
  30.         $Do1 = 0;
  31.         $Do2 = 0;
  32.         $VangDo1 = 0;
  33.         $VangDo2 = 0;
  34.  
  35.         $c2html= str_get_html($e->innertext);
  36.         foreach($c2html->find('td[class="min"]') as $e) {
  37.             $Phut = trim($e->plaintext);
  38.         }
  39.         foreach($c2html->find('td[class="sco"]') as $e) {
  40.             $TySo = trim($e->plaintext);
  41.         }
  42.         foreach($c2html->find('span[class="right name"]') as $e) {
  43.             $CauThu1 = trim($e->plaintext);
  44.         }
  45.         foreach($c2html->find('span[class="left name"]') as $e) {
  46.             $CauThu2 = trim($e->plaintext);
  47.         }
  48.         foreach($c2html->find('span[class="inc goal right"]') as $e) {
  49.             $Bong1=1;
  50.         }
  51.         foreach($c2html->find('span[class="inc goal left"]') as $e) {
  52.             $Bong2=1;
  53.         }
  54.         foreach($c2html->find('span[class="inc yellowcard right"]') as $e) {
  55.             $Vang1=1;
  56.         }
  57.         foreach($c2html->find('span[class="inc yellowcard left"]') as $e) {
  58.             $Vang2=1;
  59.         }
  60.         foreach($c2html->find('span[class="inc redcard right"]') as $e) {
  61.             $Do1=1;
  62.         }
  63.         foreach($c2html->find('span[class="inc redcard left"]') as $e) {
  64.             $Do2=1;
  65.         }
  66.         foreach($c2html->find('span[class="inc redyellowcard right"]') as $e) {
  67.             $VangDo1=1;
  68.         }
  69.         foreach($c2html->find('span[class="inc redyellowcard left"]') as $e) {
  70.             $VangDo2=1;
  71.         }
  72.  
  73.         //---------------------------//
  74.         if (strlen($Phut)>0){
  75.             $i++;
  76.             /*
  77.              echo "i=$i ::  Link: $linkTySo - Doi 1: $Doi1 - Doi2: $Doi2 : ";
  78.              echo "- Phut: " . $Phut;
  79.              echo " - Ty so: " . $TySo;
  80.              echo " - Cauthu1: ". $CauThu1;
  81.              echo " - Cauthu2: ". $CauThu2;
  82.              echo " -> Bong1: ". $Bong1 . "<br>";
  83.              echo " -> Bong2: ". $Bong2 . "<br>";
  84.              echo " -> Vang1: ". $Vang1 . "<br>";
  85.              echo " -> Vang2: ". $Vang2 . "<br>";
  86.              echo " -> Do1: ". $Do1 . "<br>";
  87.              echo " -> Do2: ". $Do2 . "<br>";
  88.              echo " -> VangDo1: ". $VangDo1 . "<br>";
  89.              echo " -> VangDo2: ". $VangDo2 . "<br>";
  90.              */
  91.  
  92.             $sqlinsert = "INSERT INTO `tivi`.`livescorechitiettrandau` (
  93.                 `idTranDau`, `Link`, `Doi1`, `Doi2`, `Phut`, `TySo`, `CauThu1`, `CauThu2`, `Bong1`, `Bong2`, `Vang1`, `Vang2`, `Do1`, `Do2`, `VangDo1`, `VangDo2`)
  94.         VALUES ('$idTranDau','$Link', '$Doi1', '$Doi2', '$Phut', '$TySo', '$CauThu1', '$CauThu2', '$Bong1', '$Bong2', '$Vang1', '$Vang2', '$Do1', '$Do2', '$VangDo1', '$VangDo2');";
  95.             echo $sqlinsert . "<br><br>";
  96.             //mysql_query($sqlinsert);
  97.         }
  98.     }
Advertisement
Add Comment
Please, Sign In to add comment