function weblio_analysis($text) { $content = file_get_contents(weblio_url($text)); $doc = phpQuery::newDocumentHTML($content); phpQuery::selectDocument($doc); $ansList = pq(".NetDicBody"); $ans = 0; $ret = "<br />"; // echo $ret; foreach ($ansList as $li) { // echo pq($li)->html().$ret; $ans++; // echo "----------------------------------------------------------------"; } return $ans; }
echo ' <form action="' . $self . '" method="GET"> <label>Search: <input type="text" name="search" /><label> <input type="submit" value="Go!"> </form> '; echo $ret; if ($search === '') { } else { echo $ret; echo "中文词语中文结果:" . $ret; echo '<a href="' . moegirl_url($search) . '">萌娘百科:' . $search . '</a>' . $ret; echo '<a href="' . baidubaike_url($search) . '">百度百科:' . $search . '</a>' . $ret; echo "--------------------------------------------------------------" . $ret; echo "日文词语日文结果:" . $ret; echo '<a href="' . weblio_url($search) . '">Weblio辞書:' . $search . '</a>' . $ret; echo '<a href="' . weblio_thesaurus_url($search) . '">Weblio類語・対義語辞典:' . $search . '</a>' . $ret; echo '<a href="' . weblio_ejje_url($search) . '">Weblio英和和英辞典:' . $search . '</a>' . $ret; echo '<a href="' . goo_url($search) . '">Goo辞書:' . $search . '</a>' . $ret; echo '<a href="' . wikipedia_url($search) . '">日文维基百科:' . $search . '</a>' . $ret; echo '<a href="' . pixivdict_url($search) . '">Pixiv百科事典:' . $search . '</a>' . $ret; echo '<a href="' . niconicodict_url($search) . '">niconico大百科:' . $search . '</a>' . $ret; echo "--------------------------------------------------------------" . $ret; echo "日文词语中文结果:" . $ret; echo '<a href="' . weblio_cjjc_url($search) . '">Weblio日中中日辞典:' . $search . '</a>' . $ret; echo '<a href="' . hj_url($search) . '">沪江词典:' . $search . '</a>' . $ret; } // echo '<a href="'. hj_url($search). '">HJDict:'.$search.'</a>'." -> ". hj_analysis($search).$ret; // echo '<a href="'. weblio_url($search). '">Weblio:'.$search.'</a>'." -> ". weblio_analysis($search).$ret; // echo '<a href="'. goo_url($search). '">Goo:'.$search.'</a>'." -> ". goo_analysis($search).$ret; // echo '<a href="'. wikipedia_url($search). '">Wikipedia:'.$search.'</a>'." -> ". wikipedia_analysis($search).$ret;