public function get()
 {
     $_oHTTP = new AmazonAutoLinks_HTTPClient($this->aURLs, $this->iCacheDuration, null, 'rss');
     $_aItems = array();
     foreach ($_oHTTP->get() as $_sHTTPBody) {
         $_aItems = array_merge($_aItems, $this->_getRSSItems($_sHTTPBody));
     }
     $this->_sort($_aItems);
     return $_aItems;
 }
 /**
  * 
  * @callback        action        aal_action_api_get_customer_review
  */
 public function doAction()
 {
     $_aParams = func_get_args() + array(null);
     $_aArguments = $_aParams[0] + array(null, null, null, null);
     $_sURL = $_aArguments[0];
     $_sASIN = $_aArguments[1];
     $_sLocale = $_aArguments[2];
     $_iCacheDuration = $_aArguments[3];
     $_oHTTP = new AmazonAutoLinks_HTTPClient($_sURL, $_iCacheDuration);
     $_sHTMLBody = $_oHTTP->get();
     if (!$_sHTMLBody) {
         return;
     }
     $_aRow = $this->_formatRow($_sURL, $_sHTMLBody, $_iCacheDuration, $_oHTTP->getCharacterSet());
     if (empty($_aRow)) {
         return;
     }
     $_oProductTable = new AmazonAutoLinks_DatabaseTable_product(AmazonAutoLinks_Registry::$aDatabaseTables['product']);
     $_iSetObjectID = $_oProductTable->setRowByASINLocale($_sASIN . '_' . strtoupper($_sLocale), $_aRow);
 }
 /**
  * Fetches HTML body with the specified URL with caching functionality.
  * 
  * @return      string
  */
 public function getHTML($sURL, $bUseFileGetContents = false, $iCacheDuration = 86400)
 {
     if ($bUseFileGetContents) {
         $_oHTML = new AmazonAutoLinks_HTTPClient_FileGetContents($sURL, $iCacheDuration);
         return $_oHTML->get();
     }
     $_oHTML = new AmazonAutoLinks_HTTPClient($sURL, $iCacheDuration);
     return $_oHTML->get();
 }
 /**
  * 
  * @callback        action      aal_action_http_cache_renewal
  */
 public function replyToRenewCache($sURL, $iCacheDuration, $aArguments, $sType = 'wp_remote_get')
 {
     $_oHTTP = new AmazonAutoLinks_HTTPClient($sURL, $iCacheDuration, $aArguments);
     $_oHTTP->deleteCache();
     $_oHTTP->get();
 }
 /**
  * 
  */
 private function _getHTMLBodies($asURLs)
 {
     $_aURLs = $this->getAsArray($asURLs);
     $_oHTTP = new AmazonAutoLinks_HTTPClient($_aURLs, $this->oUnitOption->get('cache_duration'));
     $_aHTMLBodies = $_oHTTP->get();
     // Set a debug output
     $this->_setDebugInfoForHTMLBodies($_aHTMLBodies);
     return $_aHTMLBodies;
 }
 /**
  * Retrieves the sidebar category list.
  * 
  * @since            2.0.0
  * @remark           Due to missing elements with the DOMDocument class in some Japanese pages, 
  * this method uses the simple_html_dom library.
  */
 protected function _getSidebar($sPageURL, $sLocale = 'US', $iAttempt = 0)
 {
     // Include the library.
     if (!class_exists('simple_html_dom_node')) {
         include_once AmazonAutoLinks_Registry::$sDirPath . '/include/library/simple_html_dom.php';
     }
     // This has a caching functionality.
     $_oHTTP = new AmazonAutoLinks_HTTPClient($sPageURL);
     $sHTML = $_oHTTP->get();
     if (!$sHTML) {
         return array('error' => __("Could not retrieve the category list: {$sPageURL}. Please consult the plugin developer.", 'amazon-auto-links')) + self::$aStructure_Sidebar;
     }
     // Instantiate the class.
     $_oSimpleDOM = str_get_html($sHTML);
     if (!$_oSimpleDOM->find("#zg_browseRoot", 0)) {
         $_oHTTP->deleteCache();
         // Try with a R18 confirmation redirect - must use file_get_contents(), not wp_remote()
         if ($iAttempt >= 2) {
             $_sRedirectURL = AmazonAutoLinks_Property::$aCategoryBlackCurtainURLs[$sLocale] . '?redirect=true&redirectUrl=' . urlencode($sPageURL);
             $_oHTTP = new AmazonAutoLinks_HTTPClient_FileGetContents($_sRedirectURL);
             $sHTML = $_oHTTP->get();
             if (!$sHTML) {
                 $_oHTTP->deleteCache();
                 return array('error' => __("Could not load the page for the second attempt: {$_sRedirectURL}. Please consult the plugin developer.", 'amazon-auto-links')) + self::$aStructure_Sidebar;
             }
             $_oSimpleDOM = str_get_html($sHTML);
             if (!$_oSimpleDOM->find("#zg_browseRoot", 0)) {
                 $sHTML = $_oSimpleDOM->outertext;
                 $_oHTTP->deleteCache();
                 return array('error' => sprintf(__('Could not find the category in this page: %1$s Please consult the plugin developer.', 'amazon-auto-links'), $_sRedirectURL)) + self::$aStructure_Sidebar;
             }
             return array('sRSSURL' => $this->_getCategoryFeedURL($_oSimpleDOM), 'sCategoryList' => $this->_getCategoryList($_oSimpleDOM), 'sBreadcrumb' => $this->_getBreadcrumb($_oSimpleDOM, $sLocale));
         }
         return $this->_getSidebar($sPageURL, $sLocale, ++$iAttempt);
     }
     return array('sRSSURL' => $this->_getCategoryFeedURL($_oSimpleDOM), 'sCategoryList' => $this->_getCategoryList($_oSimpleDOM), 'sBreadcrumb' => $this->_getBreadcrumb($_oSimpleDOM, $sLocale));
 }