コード例 #1
0
ファイル: fix_duckduck.php プロジェクト: superego546/SMSGyan
$duck_url = "API";
$duck_in = file_get_contents($duck_url);
$json = json_decode($duck_in, true);
$duck_retrurn = '';
$duck_or_wolf = 'duck';
echo '<br>---------------------------------------------<br>';
var_dump($json);
echo '<br>---------------------------------------------<br>';
$is_wolf = false;
if ($json['AbstractText'] && $json['AbstractSource'] == 'Wikipedia') {
    //FULL WIKI ARTICLE
    if (preg_match('~https?://en.wikipedia.org/wiki/(.+)~', $json['AbstractURL'], $matches)) {
        $sr = $matches[1];
        if (!(strpos($sr, ':') > 0 || strpos($sr, '"') > 0 || substr($sr, 0, 7) == 'List_of' || $sr == "Main_Page" || $sr == "Wikipedia")) {
            $return = fetch_mediawiki($sr, true);
            if ($return) {
                echo "FROM DUCKWIKI";
                $total_return = $return['article'];
                $to_logserver['source'] = 'wiki';
                if ($return['media']) {
                    $suggestions[$sugg_index]['option'] = "photo of " . str_replace('_', ' ', $return['title']);
                    $suggestions[$sugg_index]['list'] = array("content" => "__mwiki__image__" . $return['media'], "type" => "photo");
                    $sugg_index++;
                }
            }
        }
    }
} else {
    if ($json['AbstractText']) {
        $duck_retrurn .= $json['AbstractText'] . "\n";
コード例 #2
0
ファイル: tmpfix.php プロジェクト: superego546/SMSGyan
         $source = 'wans';
         break;
     }
 } elseif (strpos($url, 'http://www.ehow.com') !== false) {
     $total_return = fetch_ehow($url);
     if ($total_return) {
         $to_logserver['source'] = 'ehow';
         $source = 'ehow';
         break;
     }
 } else {
     if (strpos($url, 'http://en.wikipedia.org/wiki/') !== false) {
         if (preg_match('~http://en.wikipedia.org/wiki/(.+)~', $url, $matches)) {
             $sr = $matches[1];
             if (!(strpos($sr, ':') > 0 || strpos($sr, '"') > 0 || substr($sr, 0, 7) == 'List_of' || $sr == "Main_Page" || $sr == "Wikipedia")) {
                 $return = fetch_mediawiki($sr);
                 if ($return) {
                     if ($return['exact']) {
                         $total_return = $return['article'];
                         $to_logserver['source'] = 'wiki';
                         if ($source == 'wiki_ext') {
                             $suggestions[$sugg_index]['option'] = "Full article: " . $return['title'];
                             $suggestions[$sugg_index]['list'] = array("content" => $return['title'], "type" => "Also read");
                             $sugg_index++;
                         }
                         break;
                     } else {
                         if (!$total_return_tmp) {
                             $total_return_tmp = $return['article'];
                             $source_machine_tmp = $source_machine;
                             $current_file_tmp = $current_file;