2012-02-25 32 views
5

Ho un piccolo problema con php curl post.PHP Curl post con caratteri non inglesi

Sto cercando di inviare alcuni caratteri turchi a un forum ma non sono pubblicati come dovrebbe essere.

Questo è come mi salvare il testo:

 

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

e la pubblicazione:

$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); 

questo è come dovrebbe essere:

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

questo è come è pubblicato:

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

Grazie

+0

Sei uno spammer? –

+2

spammer? come hai ottenuto questa conclusione? solo perché ho chiesto aiuto su una funzione PHP? – gtht90

risposta

2

fisso con

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

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

Prova ad aggiungere:

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

application/x-www-form-urlencoded suggerite da @spencercw

+0

non funziona. ricevo "La tua richiesta non può essere elaborata perché mancava un token di sicurezza." – gtht90

+1

Suppongo che tu abbia bisogno di un tipo di contenuto di 'application/x-www-form-urlencoded' invece di' text/xml'. – spencercw

+0

La variabile '$ post_fields' contiene una voce' securitytoken'? – seanbreeden