id)) { if($node->id == TIDY_TAG_A) { if(stristr($node->attribute['href'], '/archives/') === FALSE) { }else{ $asin_tmp = explode("/",$node->attribute['href']); $title_tmp = $node->attribute['title']; // echo $title_tmp; // echo '
';
//				print_r($node->child[0]->value);
//	echo '
'; $tmp = $asin_tmp[ASIN_POSITION]; $urls[] = array("asin" =>$tmp , "title" =>$title_tmp); // $urls[] = array("asin" =>$tmp , "title" =>$node->child[0]->value); } } } if($node->hasChildren()) { foreach($node->child as $c) { dump_nodes_title($c, $urls); } } return $urls; } function get_BOOKLOG_ASIN($word,$tidy_encode,$mb_encode){ $json = new Services_JSON(); $url = BASE_URI.$word.POST_URI; // http://booklog.jp/users/ryouchi // echo $url; $rdata = http_request($url); // $data = mb_convert_encoding($rdata['data'],"utf-8","EUC-JP"); $data = mb_convert_encoding($rdata['data'],$mb_encode,"UTF-8"); $config = array('indent' => TRUE, 'output-xhtml' => TRUE, 'wrap' => 200); // $a = tidy_parse_string($data, $config, 'UTF8'); $a = tidy_parse_string($data, $config, $tidy_encode); $a->cleanRepair(); $urls = dump_nodes_title($a->html()); $asin = array(); $key = "asin"; /* foreach ($urls as $u){ // if(stristr($u, 'asin') === FALSE) { // }else{ $asin_tmp = explode("/",$u); $tmp = array("asin" =>$asin_tmp[ASIN_POSITION]); array_push ($asin , $tmp); // } }*/ $js = $json->encode($urls); if ($_GET['callback']<>""){ $var = $_GET['var']; $src = $_GET['callback']."("; $src .= $js; $src .=");"; echo $src; } } // main if($_GET["user"] <>"") { if ($_GET["encode"]<>""){ $tidy_encode = "utf8"; $mb_encode = "UTF-8"; }else{ if(stristr($_GET["encode"], 'UTF-8') !== FALSE) { if(stristr($_GET["encode"], 'SJIS') !== FALSE) { if(stristr($_GET["encode"], 'EUC-JP') !== FALSE) { $tidy_encode = "utf-8"; $mb_encode = "UTF-8"; }else{ $tidy_encode = "euc-jp"; $mb_encode = "EUC-JP"; } }else{ $tidy_encode = "shiftjis"; $mb_encode = "SJIS"; } }else{ $tidy_encode = "utf8"; $mb_encode = "UTF-8"; } } get_BOOKLOG_ASIN($_GET["user"],$tidy_encode,$mb_encode); } ?>