2016-07-21 16 views
2

Ich versuche, einen RSS-Feed zu bekommen, ich entferne alle Stoppwörter, stemmm ... aber es funktioniert manchmal. Ich weiss nicht, was vorgeht. Könnte jemand meinen Code sehen und mir sagen, wo der Fehler ist? BitteDie Webseite ist vorübergehend nicht verfügbar oder sie ist möglicherweise dauerhaft an eine andere Adresse verschoben worden. ERR_RESPONSE_HEADERS_TRUNCATED

functions.php

<?php 
include ("stemm_es.php"); 

function quitarAcento($incoming_string){ 
    $tofind = "ÀÁÂÄÅàáâäÒÓÔÖòóôöÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ"; 
    $replac = "AAAAAaaaaOOOOooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"; 
    return utf8_encode(strtr(utf8_decode($incoming_string), 
          utf8_decode($tofind), 
          $replac)); 
} 

function limpiar($String){ 
    $String = str_replace(array('á','à','â','ã','ª','ä'),"a",$String); 
    $String = str_replace(array('Á','À','Â','Ã','Ä'),"A",$String); 
    $String = str_replace(array('Í','Ì','Î','Ï'),"I",$String); 
    $String = str_replace(array('í','ì','î','ï'),"i",$String); 
    $String = str_replace(array('é','è','ê','ë'),"e",$String); 
    $String = str_replace(array('É','È','Ê','Ë'),"E",$String); 
    $String = str_replace(array('ó','ò','ô','õ','ö','º'),"o",$String); 
    $String = str_replace(array('Ó','Ò','Ô','Õ','Ö'),"O",$String); 
    $String = str_replace(array('ú','ù','û','ü'),"u",$String); 
    $String = str_replace(array('Ú','Ù','Û','Ü'),"U",$String); 
    $String = str_replace(array('[','^','´','`','¨','~',']','"',"'",'(',')','{','}',',','.',':',';','%','-', 
           '#','@','|','!','·','$','&','/','?','¡','¿','+', '”', '“', '’', '‘'),"",$String); 
    $String = str_replace("ç","c",$String); 
    $String = str_replace("Ç","C",$String); 
    $String = str_replace("ñ","n",$String); 
    $String = str_replace("Ñ","N",$String); 
    $String = str_replace("Ý","Y",$String); 
    $String = str_replace("ý","y",$String); 

    $String = str_replace("&aacute;","a",$String); 
    $String = str_replace("&Aacute;","A",$String); 
    $String = str_replace("&eacute;","e",$String); 
    $String = str_replace("&Eacute;","E",$String); 
    $String = str_replace("&iacute;","i",$String); 
    $String = str_replace("&Iacute;","I",$String); 
    $String = str_replace("&oacute;","o",$String); 
    $String = str_replace("&Oacute;","O",$String); 
    $String = str_replace("&uacute;","u",$String); 
    $String = str_replace("&Uacute;","U",$String); 
    return $String; 
} 

function getFeed($feed_url) { 
    $x = simplexml_load_string(file_get_contents($feed_url)); 

    $stopwords = file_get_contents('stopword.txt'); 
    $stopwords = explode(" ", $stopwords); 
    $t=0; 
    foreach($x->channel->item as $entry){ 
     $t++; 
     $title = trim(strip_tags(mb_strtolower(limpiar($entry->title)))); 
     $description = trim(strip_tags(mb_strtolower(limpiar($entry->description)))); 
     $title = explode(" ", $title); 

     $description = explode(" ", $description); 

     for($j = 0; $j < count($title); $j++){ 
      if($title[$j] != ""){ 

       for($i = 0; $i < count($stopwords); $i++){ 
        if($stopwords[$i] != ""){ 
         $title[$j] = preg_replace("/\b$stopwords[$i]\b/i", " ", $title[$j]); 
         $title[$j] = stemm_es::stemm($title[$j]); 
        } 
       } 
      } 
     } 
     for($j = 0; $j < count($description); $j++){ 
      if($description[$j] != ""){ 

       for($i = 0; $i < count($stopwords); $i++){ 
        if($stopwords[$i] != ""){ 
         $description[$j] = preg_replace("/\b$stopwords[$i]\b/i", " ", $description[$j]); 
         $description[$j] = stemm_es::stemm($description[$j]); 
        } 
       } 
      } 
     } 
     print_r($title); 
     print_r($description); 
    } 
} 
?> 

index.php

<!DOCTYPE html> 
<html class="no-js" lang="es"> 
<head> 
<meta charset="utf-8"> 
<title>Inicio | Investigador</title> 
</head> 
<body> 
    <?php require "functions.php"; ?> 
    <?php 
    $feed = "http://ep00.epimg.net/rss/ccaa/valencia.xml"; 
    if ($feed != "") { 
     getFeed(feed); 
    } 
    ?> 
</body> 
</html> 
+0

können Sie erklären, was passiert, welche Fehler Sie bekommen etc etc – RamRaider

Antwort

0

Wir dieses Problem für einige Benutzer mit einer aktuellen Veröffentlichung entstehen gehabt haben. Nicht sicher, ob es uns oder Timing mit Chrome ist.

Es betrifft nur einige Benutzer und nur in Chrome, und Clearing-Cache hat den meisten Benutzern geholfen, aber nicht alle.

Immer noch auf der Suche nach einer definitiven Lösung.

EDIT:

Nach einer looooong Zeit, die ich für mich beschlossen, es tatsächlich durch die Session-Konfigurationseinstellungen in CodeIgniter zu aktualisieren.

Ich aktualisiere musste:

$config['sess_encrypt_cookie'] = FALSE; 

zu:

 $config['sess_encrypt_cookie'] = TRUE; 

Was beim ersten Login war geschah, würde es funktionieren, aber die zweite Anmeldung wurde eine Art von Konflikt mit der immer Plätzchen.

Ich habe nicht genau herausgefunden, was das Problem war, aber das scheint ein Chrome-basierter Bug zu sein, den ein paar Leute über die Jahre gehabt haben, aber da ist nicht viel dran.