2011-09-23 2 views
-1
%3Cimg+src%3D%27http%3A%2F%2Fmnmstatic.net%2Fcache%2F15%2F15%2Fthumb-1381820.jpg%27+width%3D%2760%27+height%3D%2760%27+alt%3D%27%27+class%3D%27thumbnail%27+style%3D%27float%3Aright%3Bmargin-left%3A+3px%27+align%3D%27right%27+hspace%3D%273%27%2F%3E%3Cp%3EAunque+se+haya+dado+marcha+atr%C3%A1s%2C+lo+que+ha+ocurrido+en+RTVE+es+muy+serio.+Seg%C3%BAn+Gabilondo%2C+este+asunto+nos+permite+ver+con+claridad+por+d%C3%B3nde+va+la+pol%C3%ADtica+y+por+d%C3%B3nde+va+el+pensamiento+del+PP+entorno+a+la+libertad+de+informaci%C3%B3n.%3C%2Fp%3E%3Cp%3E%3Cstrong%3Eetiquetas%3C%2Fstrong%3E%3A+tve%2C+i%C3%B1aki+gabilondo%3C%2Fp%3E%3Cp%3E%3Ca+href%3D%22http%3A%2F%2Fmenea.me%2Ftm7w%22%3E%3Cimg+src%3D%22http%3A%2F 
%2Fwww.meneame.net%2Fbackend%2Fvote_com_img.php%3Fid%3D1381820%22+alt%3D%22votes%22+width 
%3D%22200%22+height%3D%2216%22%2F%3E%3C%2Fa%3E%3C%2Fp%3E%3Cp%3E%26%23187%3B%26nbsp%3B%3Ca+href%3D%22http%3A%2F%2Fblogs.cadenaser.com%2Fla-voz-de-inaki%2F2011%2F09%2F23%2Ftve-acorralada%2F%22+onmousedown%3D%22this.href%3D%27http%3A%2F%2Fwww.meneame.net%2Fbackend%2Fgo.php%3Fid%3D1381820%27%3B+return+true%22+%3Enoticia+original%3C%2Fa%3E%3C%2Fp%3E 

이것은 MySQL 데이터베이스에 저장하려고 시도하는 RSS 파일 $item->description의 텍스트입니다.하지만 빈 문자열을 저장합니다.이 텍스트는 텍스트 mysql 필드에 빈 것으로 저장됩니다.

이 텍스트 샘플은 $mysql 쿼리 바로 전에 echo 아래에 있습니다.

앞에는 %3C이 붙어 있나요?

전체 스크립트는 다음과 같습니다 데이터베이스

$insert = "INSERT INTO links (nombre, coment, url, iduser,fecha,priv) 
           VALUES ('$b','$r_int','$texto ','$id_tmp',NOW(),'$priv')"; 

텍스트가 하늘 저장되는 이유는 어떤 생각에서

$filename = "http://www.ofertasybonos.com/blog/?feed=rss2"; 
$feed = simplexml_load_file($filename); 

// Iterate through the list and create the unordered list 
$n = false; 
foreach ($feed->channel->item as $item) { 
      $user  = "ofertasybonos"; 
      $pass  = "ofertasybono"; 
      $title = urlencode($item->title); 
      if(strlen($item->description)>6000){ 
    $notes = urlencode(substr($item->description, 6000).'..'); 
}else{ 
    $notes = urlencode($item->description); 
} 
      $url = urlencode($item->link); 
      $tags = ''; $tags .= urlencode(urlencode($item->category)); if($tags=='') $tags = urlencode("ofertas, bonos"); 

      $params = "nombre=$user&pass=$pass&url=$url&tags=$tags&notes=$notes&title=$title"; 

      $res = file_get_contents ("http://domain.com/API/public/autosave.php?$params"); 
      /*this file getContents stores in database*/ 


    $n = true; 
} 


this is how is (supoused to be) stored 

받아 봐 데이터 형식 file_get_contents

$texto = urldecode($_GET['notes']); 

스토어?

+0

어디에 저장하고 해당 문자열을 검색하는 코드가 있어요? – Mat

+0

문자열이 올바른지 확인 했으므로 문제는 데이터베이스에 저장하는 방법 일 가능성이 높습니다. 따라서 질문에 MySQL 코드를 포함시켜야합니다. – hammar

+0

'% 3C'는'<'로, MySQL에서는 특별한 의미가 없습니다. '%'는 특별한 의미를 지니 며, 그것은 와일드 카드입니다. 그리고 저는 '%'와 같이'\'와 같이 이스케이프되어야합니다 : '\ % 3C .....'라고 생각합니다. – Johan

답변

0

그게 정확한 해결책인지는 모르지만 데이터를 직렬화하려고하면 어떻게됩니까?

데이터를 serialize하는 방법은 serialize()입니다. http://php.net/manual/en/function.serialize.php 데이터를 직렬화 해제하는 방법은 unserialize()입니다.

0

http://www.php.net/manual/en/function.unserialize.php 당신은 앞에 $를 잊어 texto의

$insert = "INSERT INTO links (nombre, coment, url, iduser,fecha,priv) VALUES ('$b','$r_int','$texto','$id_tmp',NOW(),'$priv')";

+0

아하 .. 사실. .php 파일의 질문에만 적합합니다. 감사합니다. & 죄송합니다. –

관련 문제