Example #1
0
 private function do_get_temp()
 {
     $five_rows = Model_Horoscope_XungHopLinkBLL::GetRecords_UnProccessed($num_of_rows = 10);
     if ($five_rows) {
         $count = count($five_rows);
         for ($i = 0; $i < $count; $i++) {
             $_ID = $five_rows[$i]['id'];
             $_URI = $five_rows[$i]['uri'];
             $_Cung1 = $five_rows[$i]['cung_1'];
             $_Cung2 = $five_rows[$i]['cung_2'];
             $_Summary = $five_rows[$i]['summary'];
             $_ImageLink = $five_rows[$i]['hinh_anh'];
             //check uri in story table
             if (Model_Horoscope_XungHopBLL::CheckRecordByURI($_URI)) {
                 //(dup) existed => not need to insert => update from tmp table
                 Model_Horoscope_XungHopLinkBLL::MarkAsDone($_ID, $_URI);
             } else {
                 //begin get content
                 $content = Vendor_Crawler::get_content_from_uri_by_curl($_URI);
                 if ($content) {
                     //process content just got
                     Model_Horoscope_XungHopBLL::_Process_Recieved_Content($content['output'], $_Cung1, $_Cung2, $_Summary, $_URI, $_ID, $_ImageLink);
                 } else {
                     Model_Horoscope_XungHopBLL::_print_to_console(__("<--- CANT GET CONTENT --->"));
                 }
             }
         }
         //EOF for loop
     } else {
         unset($five_rows);
         return false;
     }
     unset($five_rows);
     //do recursive
     $this->do_get_temp();
 }