public function get_taobao_goods_list()
 {
     $i = 1;
     $page_size = 200;
     $top_client = get_top_client();
     do {
         $req = new ItemsGetRequest();
         $req->setFields("num_iid");
         $req->setNicks("通拓科技");
         $req->setPageSize($page_size);
         $req->setPageNo($i);
         $resp = $top_client->execute($req);
         $total_num = $resp->total_results;
         $total_items = $resp->items;
         foreach ($total_items as $total_item) {
             foreach ($total_item as $item) {
                 $num_id = $item->num_iid;
                 $this->get_item_list($num_id);
             }
         }
         $i++;
     } while ($total_num > $page_size * $i);
 }
 public function items_get()
 {
     if (strpos($_SERVER['SCRIPT_FILENAME'], 'get_mytaotao_list.php') === FALSE) {
         exit;
     }
     $i = 1;
     $page_size = 200;
     $top_client = get_top_client();
     $request_counter = 1;
     do {
         $req = new ItemsGetRequest();
         $req->setFields("num_iid");
         $req->setNicks($this->nickname);
         $req->setPageSize($page_size);
         $req->setPageNo($i);
         $resp = $top_client->execute($req);
         $total_num = $resp->total_results;
         $total_items = $resp->items;
         echo "total: {$total_num}, items: ", count($total_items), "\n";
         foreach ($total_items as $total_item) {
             foreach ($total_item as $item) {
                 if ($request_counter++ > 100) {
                     echo 'sleeping for 120 secends', "\n";
                     sleep(120);
                     $request_counter = 1;
                     // reset request counter
                 }
                 $num_id = $item->num_iid;
                 $this->item_get($num_id);
             }
         }
     } while ($total_num > $page_size * $i++);
 }