1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Curl post with non-english characters

Discussion in 'PHP' started by t3od0r, Feb 25, 2012.

  1. #1
    I have a small problem with php curl post.

    I am trying to post some turkish characters to a forum but aren't posted how it should be.

    This is how i save the text:
    fwrite($fpp,"\xEF\xBB\xBF");
    fwrite($fpp, $row['template']);
    fclose($fpp);
    
    PHP:
    and posting:
    $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 );
    PHP:
    this is how it should be:
    Bölüm resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz. 
    Code (markup):
    this is how it is posted:
    Bölüm resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz. 
    Code (markup):
    Thanks
     
    t3od0r, Feb 25, 2012 IP
  2. lonelygrit

    lonelygrit Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Edit you DB Collation to "utf8_general_ci" and try again
     
    lonelygrit, Feb 25, 2012 IP
  3. t3od0r

    t3od0r Well-Known Member

    Messages:
    334
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    155
    #3
    there is already, also in the txt is saved correctly and when i read the txt the output is ok, but when i post in't ok anymore
     
    t3od0r, Feb 25, 2012 IP
  4. lonelygrit

    lonelygrit Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Don't use utf-8 BOM (\xEF\xBB\xBF) in your txt file
     
    lonelygrit, Feb 26, 2012 IP