Ejemplo n.º 1
0
<?php

require_once "../JentiConfig.php";
require_once "../JentiRequestWiktionary.php";
$request = new JentiRequestWiktionary($config);
$result = $request->get_word("guerra");
//$request->get_web_page("http://it.wiktionary.org/wiki/razionale");
if ($request->error) {
    echo $request->error;
}
echo "<PRE>" . print_r($result, true) . "</PRE>";
$request->debug_echo_dom(null, 0, null, null);
Ejemplo n.º 2
0
//////////////////////////////////////////////////////////////////////////
// output string to scrolling log
//////////////////////////////////////////////////////////////////////////
function echo_msg_flush($msg)
{
    echo '<script language="JavaScript" type="text/javascript">' . 'log_write( \'' . str_replace(array('\'', "\n", "\r"), array('"', "", ""), $msg) . '\');' . '</script>';
    for ($k = 0; $k < 50000; $k++) {
        echo ' ';
    }
    echo PHP_EOL;
}
// Turn off output buffering
ini_set('default_socket_timeout', 36000);
ini_set('max_execution_time', 36000);
$words = explode(PHP_EOL, "guerra\ncombattere\nsanguinoso");
$request = new JentiRequestWiktionary($config);
$jenti_word = new JentiWord($config);
ob_implicit_flush(TRUE);
$log = log_open();
foreach ($words as $word) {
    $word_array = $request->get_word($word);
    if ($request->error) {
        echo_msg_flush($request->error);
        log_writeln($log, $request->error);
        continue;
    }
    foreach ($word_array as $word_info) {
        $jenti_word->add_word_and_definitions($word_info);
        if (!$jenti_word->error) {
            echo_msg_flush(print_r($word_info, true));
            log_writeln($log, print_r($word_info, true));