function runUpdate($id) { echo "Updating Keywords For Product ID: " . $id; //echo ("Updating for $id" . $this->lineBreak); $hop = "http://" . $this->clickbankID . "." . $id . ".hop.clickbank.net"; $hop = $this->get_final_url($hop); //$hop = "http://chrisqueen.com/CB/" . $id; //set the length of keywords you like $params['min_word_length'] = 5; //minimum length of single words $params['min_word_occur'] = 2; //minimum occur of single words $params['min_2words_length'] = 3; //minimum length of words for 2 word phrases $params['min_2words_phrase_length'] = 10; //minimum length of 2 word phrases $params['min_2words_phrase_occur'] = 2; //minimum occur of 2 words phrase $params['min_3words_length'] = 3; //minimum length of words for 3 word phrases $params['min_3words_phrase_length'] = 10; //minimum length of 3 word phrases $params['min_3words_phrase_occur'] = 2; //minimum occur of 3 words phrase $autokeyword = new autokeyword($hop, $params); $words = array(); // add meta keywords from page $metaKeywordsArray = explode(",", $autokeyword->getMetaKeywords()); array_splice($words, count($words), 0, $metaKeywordsArray); array_splice($words, count($words), 0, $autokeyword->parse_words()); array_splice($words, count($words), 0, $autokeyword->parse_2words()); array_splice($words, count($words), 0, $autokeyword->parse_3words()); $words = array_unique($words); $finalWords = array(); // Remove Numbers foreach ($words as $word) { $word = trim($word); if (!is_numeric($word) && strlen($word) > 2) { $finalWords[] = $word; } } if (count($finalWords) > 0 && strlen($id) > 0) { //$keywordQuery = "REPLACE INTO keywords (id,words) VALUES ('$id','" . json_encode ( $finalWords ) . "');"; $keywordQuery = "'{$id}','" . json_encode($finalWords) . "'"; $this->waitForLockAndWrite($this->updateDBQueryFilename, $keywordQuery); //$this->getLogger ()->logInfo ( "Query for $id: Added!" ); } else { echo "No content for {$id} <br>"; $query = "Insert into BadIDs (id) values ('{$id}') on duplicate key update count=count+1;"; $this->runQuery($query, $this->getDBConnection()->getDBConnection()); } }