2012-02-25 14 views
5

Tengo un pequeño problema con la publicación curl de php.Publicación de PHP Curl con caracteres no ingleses

Estoy tratando de publicar algunos caracteres turcos en un foro pero no se publican como debería ser.

Éste es cómo guardar el texto:

 

    fwrite($fpp,"\xEF\xBB\xBF"); 
    fwrite($fpp, $row['template']); 
    fclose($fpp); 

y aviso:

$this->curl = curl_init(); 
    curl_setopt ($this->curl, CURLOPT_URL, $this->vb_url . 'newthread.php?' . $url_vars); 
    curl_setopt ($this->curl, CURLOPT_POST, true); 
    curl_setopt ($this->curl, CURLOPT_POSTFIELDS, $post_fields); 
    curl_setopt ($this->curl, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt ($this->curl, CURLOPT_CONNECTTIMEOUT,20); 
    curl_setopt ($this->curl, CURLOPT_TIMEOUT,10); 
    curl_setopt ($this->curl, CURLOPT_HEADER, true); 
    curl_setopt ($this->curl, CURLOPT_FOLLOWLOCATION, 0); 
    curl_setopt ($this->curl, CURLOPT_COOKIE, $this->cookie_name); 
    curl_setopt ($this->curl, CURLOPT_COOKIEJAR, $this->cookie_name); 
    curl_setopt ($this->curl, CURLOPT_COOKIEFILE, $this->cookie_name); 
    curl_setopt ($this->curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1'); 
    $result = curl_exec ($this->curl); 

así es como debe ser:

`Bölüm resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz.`

así es como se está publicado:

`Bölüm resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz.`

Gracias

+0

¿Eres un spammer? –

+2

spammer? ¿Cómo obtuviste esta conclusión? solo porque pedí ayuda en una función php? – gtht90

Respuesta

2

fija con

$message = @iconv("UTF-8","Windows-1252//IGNORE",$message); 
1

De http://php.net/manual/es/function.curl-setopt.php

Trate de añadir:

curl_setopt($this->curl,CURLOPT_HTTPHEADER,array (
    "Content-Type: application/x-www-form-urlencoded; charset=utf-8" 
)); 

application/x-www-form-urlencoded sugeridas por @spencercw

+0

no funciona. me aparece "Tu envío no se pudo procesar porque faltaba un token de seguridad". – gtht90

+1

Supongo que necesita un tipo de contenido 'application/x-www-form-urlencoded' en lugar de' text/xml'. – spencercw

+0

¿Su variable '$ post_fields' contiene una entrada' securitytoken'? – seanbreeden