I am not sure what I did wrong...
I am using PHP Version 5.2.3 and mysql 5.0.41
When I try and run the scheduled task to populate the database I get the following error:
Code:
RosterMasterUpdater
db)) { exit; } //require_once(DIR . '/includes/rostermaster/logging.php'); function error_message($message, $sql="") { //todo vbulletin log error echo "
" ."
Roster Master Error
" ."Error:
" ."$message
"; // Show's over. exit; } // FUNCTION: rm_prune_log() // Delete log entries older than specified number of days. // Arguments: $days - Maximum age (in days) to keep // Returns: None. function rm_prune_log($days) { global $vbulletin; $cutoff = (time() - ($days * 60 * 60 * 24)); $query = "DELETE FROM " . TABLE_PREFIX . "roster_master_log " ."WHERE date < $cutoff"; if(!($result = $vbulletin->db->query($query))) { error_message('rostermaster_unable_to_prune_database',$query); } } function add_to_log($type, $message, $level=1) { global $vbulletin; if ($level <= $vbulletin->options['rostermaster_logging_verbosity']) { $query = "INSERT INTO " . TABLE_PREFIX . "roster_master_log " ."(date, type, message, level) " ."VALUES (" .time().",'$type','".addSlashes($message)."', $level)"; } } // *********************************XML Parser ***************************************** function startElement($parser, $name, $attr) { global $member, $currentElement, $row; if ($name == 'member') { $member = TRUE; $row = array(); } // name and level are sub-elements of characterclass/artisanclass. // If we were handling something involving char/artisanclass, we modify the element // name to discern wether we're working on the name or the level sub-elements. $matches = array(); if ($member && preg_match('/^(characterclass|artisanclass)/', $currentElement, $matches)) { $currentElement = $matches[1].'<'.$name; } else { $currentElement = $name; } } function characterData($parser, $data) { global $member, $currentElement, $row; if ($member) { $data = trim($data); switch ($currentElement) { case 'link': $field = 'Char_id'; break; case 'name': $field = 'Name'; break; case 'lastname': $field = 'Lastname'; break; case 'rank': $field = 'Rank'; break; case 'characterclass~\\1~<",$row[$field]); } } } } function endElement($parser, $name) { global $member, $currentElement, $row, $rm_roster_data, $vbulletin; switch ($name) { // We were working on sub-elements of either of these case 'characterclass': case 'artisanclass': $currentElement = ''; break; // We just finished processing a member. case 'member': // We have everything expected to form a full member - processing it if (count($row) == 14) { // Convert date to timestamp. if ($row['Joined']) { $row['Joined'] = strtotime($row['Joined']); } // Clean up numbers, so they can be easily sorted. // We can reformat at display time if needed. $row['Quests'] = str_replace(',', '', $row['Quests']); // $row['KVD'] = floatval($row['KVD']); $row['Points'] = str_replace(',', '', $row['Points']); // $row['highestmeleehit'] = intval($row['highestmeleehit']); // $row['highestmagichit'] = intval($row['highestmagichit']); $row['rank_value'] = (!empty($rmconfig['lookup_rank'][$row['Rank']])) ? $rmconfig['lookup_rank'][$row['Rank']] : 99; // Create a rank_value based on the lookup // Store element data in global array. $rm_roster_data[$row['Name']] = $row; // Reset for next member element. $member = FALSE; } else { $GLOBALS['badlines']++; } break; } } // Function: fetch_URL() // Retrieve the requested webpage and returns it // Arguments: $url_fetch = the url of the desired webpage // // Return: The content of the retrieved URL, or NULL if an error occured. function fetch_URL($url_fetch) { global $vbulletin; if ($vbulletin->options['rostermaster_curluse']) { $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, $url_fetch); curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cUrl, CURLOPT_TIMEOUT, '30'); if (($vbulletin->options['rostermaster_curlip']) && ($vbulletin->options['rostermaster_curlport'])) { curl_setopt($cUrl, CURLOPT_PROXY, "{$vbulletin->options['rostermaster_curlip']}:{$vbulletin->options['rostermaster_curlport']}"); } $pageContent = curl_exec($cUrl); // If there was an error, close the handle and report error message. if (curl_errno($cUrl)) { // Build error message before closing handle and exiting to the error display function. $errormsg = "(CURL) Error ".curl_errno($cUrl).": ".curl_error($cUrl)."
\n" ."Cannot retrieve data from the EQ2Players website!"; curl_close($cUrl); add_to_log("Error",$errormsg,1); return NULL; } curl_close($cUrl); } else { if (!($pageContent = file_get_contents($url_fetch))) { add_to_log("Error","Cannot retrieve data from the EQ2Players website!",1); } } return $pageContent; } // Function: parse_guild_HTML() // Retrieves and parses the HTML guild summary page from the EQ2players.com site. // Arguments: &$log = pointer to the log array (used by the flatfile log) // $url = URL of the Guild Summary page on EQ2Players.com // Returns: TRUE on success. function parse_guild_HTML(&$log, $url) { global $vbulletin, $mod_dirname,$rm_roster_data,$rm_summary_data; // Fetch and parse the guild summary page. $i = 0; $rlimit = 1; do { if ($raw_data = fetch_URL($url)) { // Got the data, bail out of the loop. break; } $stime = pow(3, $i++); if ($i < $rlimit) { // Sleep for 3^n seconds... sleep($stime); } } while ($i < $rlimit); if (empty($raw_data)) { // Unable to read the URL as presented add_to_log("Error","Unable to access EQ2Players for HTML parsing!",1); return FALSE; } // Verify that the configured guild name is found on the webpage. if (strpos($raw_data, $vbulletin->options['rostermaster_guild_name']) === FALSE) { error_message(''.sprintf('(XML) '._ERR_GRGNSC, $vbulletin->options['rostermaster_guild_name'])."
I couldnt post the entire output, if you need more let me know.
any suggestions?