2012-02-25 33 views
5

Tôi có một vấn đề nhỏ với bài đăng php curl.Bài đăng PHP Curl với các ký tự không phải tiếng Anh

Tôi đang cố gắng đăng một số ký tự tiếng Thổ Nhĩ Kỳ lên diễn đàn nhưng không được đăng như thế nào.

Đây là cách tôi lưu các văn bản:

 

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

và gửi bài:

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

đây là cách nó nên là:

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

đây là cách nó được đăng:

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

Cảm ơn

+0

Bạn có phải là người gửi spam không? –

+2

spammer? làm thế nào bạn có kết luận này? chỉ vì tôi yêu cầu trợ giúp về chức năng php? – gtht90

Trả lời

2

cố định với

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

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

Hãy thử thêm:

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

application/x-www-form-urlencoded đề xuất bởi @spencercw

+0

không hoạt động. Tôi nhận được "Không thể xử lý nội dung gửi của bạn vì thiếu mã thông báo bảo mật". – gtht90

+1

Tôi đoán bạn cần một kiểu nội dung 'application/x-www-form-urlencoded' thay vì' text/xml'. – spencercw

+0

Biến '$ post_fields' của bạn có chứa mục nhập' securitytoken' không? – seanbreeden

Các vấn đề liên quan