PHP包含非英语字符的Curl帖子 [英] PHP Curl post with non-english characters
本文介绍了PHP包含非英语字符的Curl帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个小问题php curl post。
我试图发布一些土耳其字符到论坛,但不会公布它应该是什么。 / p>
这是我如何保存文本:
fwrite $ fpp,\xEF\xBB\xBF);
fwrite($ fpp,$ row ['template']);
fclose($ fpp);
并张贴:
$ b b$ 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);
这应该是:
`bölümresimleri,dizi indirme vealtyazılinkineaşağıdanulaşabilirsiniz.`
这是如何发布的:
`bölümresimleri,dizi indirme vealtyazılinkineaÅŸağıdanulaÅŸabilirsiniz.`
$ b感谢
解决方案
$ message = @iconv(UTF-8,Windows-1252 // IGNORE,$ message);
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);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 );
this is how it should be:
`Bölüm resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz.`this is how it is posted:
`Bölüm resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz.`Thanks
解决方案Fixed with
$message = @iconv("UTF-8","Windows-1252//IGNORE",$message);
这篇关于PHP包含非英语字符的Curl帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文