id)) { if($node->id == TIDY_TAG_A) { $urls[] = $node->attribute['href']; if($node->type == TIDY_NODETYPE_TEXT) { echo $node->value.'\n'; } } } if($node->hasChildren()) { foreach($node->child as $c) { dump_nodes($c, $urls); } } return $urls; } function get_BOOKLOG_ASIN($word){ $json = new Services_JSON(); $url = BASE_URI.$word.POST_URI; $rdata = http_request($url); $data = mb_convert_encoding($rdata['data'],"utf-8","auto"); $a = tidy_parse_string($data); $a->cleanRepair(); $urls = dump_nodes($a->html()); $asin = array(); $key = "asin"; foreach ($urls as $u){ if(stristr($u, 'archives') === FALSE) { }else{ $asin_tmp = explode("/",$u); $tmp = array("asin" =>$asin_tmp[ASIN_POSITION]); // array_push ($asin , $asin_tmp); array_push ($asin , $tmp); } } $js = $json->encode($asin); if ($_GET['callback']<>""){ $var = $_GET['var']; $src = $_GET['callback']."("; $src .= $js; $src .=");"; echo $src; } } // main if($_GET["user"] <>"") { get_BOOKLOG_ASIN($_GET["user"]); } ?>