function process_match($match_id) { global $commentary1; global $commentary2; global $mentions; echo "Processing match {$match_id}\n"; $commentary1 = read_inning_commentary($match_id, 1); //read first inning $commentary2 = read_inning_commentary($match_id, 2); //read the second inning $cx1 = count($commentary1); $cx2 = count($commentary2); debug("cx1={$cx1} cx2={$cx2}\n"); read_report($match_id); //echo "Printing mentions for $match_id\n"; //print_r($mentions); create_mention_file($mentions, $match_id); create_tagged_file($mentions, $match_id); echo "Completed processing match {$match_id}\n"; }
function read_self_attack_reports() { // TEST /* $id = "4436942"; if(!mysql_query("delete from reports where id = $id")) die(mysql_error()); read_report($id, "- 攻擊 村莊"); return; */ global $server; $s = 0; while (true) { $url = "http://{$server}/berichte.php?s={$s}&t=3"; echo $url . "\n"; $ch = my_curl_init(); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); curl_close($ch); // <td class="sub"><a href="berichte.php?id=26188365">? 攻擊 我已經蓋陷阱了@@</a> (新)</td> // <div><a href="berichte.php?id=34902718">C03 attacks g rudios`s village</a> (new)</div> // <a href="berichte.php?id=34909013">C03 attacks KamE_kAze</a> </div> if (!preg_match_all('#<a href="berichte\\.php\\?id=([0-9]+)">([^<]+)</a> [^<]+</div>#', $result, $matches, PREG_SET_ORDER)) { break; } foreach ($matches as $match) { $id = $match[1]; $title = $match[2]; read_report($id, $title); } $s += 10; } }