Results 1 to 10 of 15
-
25th Feb 2012, 03:55 PM #1OPMemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comPHP Curl post with non-english characters
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:
PHP Code:fwrite($fpp,"\xEF\xBB\xBF");
fwrite($fpp, $row['template']);
fclose($fpp);
PHP Code:$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 );
Code:B?l?m resimleri, dizi indirme ve altyazı linkine aşağıdan ulaşabilirsiniz.
Code:Bölüm resimleri, dizi indirme ve altyaz? linkine a?a??dan ula?abilirsiniz.
t3od0r Reviewed by t3od0r on . PHP Curl post with non-english characters 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); fclose($fpp); and posting: Rating: 5
-
25th Feb 2012, 04:13 PM #2Member
I'm not quite sure but maybe setting CURLOPT_ENCODING could help.
-
26th Feb 2012, 01:16 AM #3(╯?□?)╯︵ ┻━┻Website's:
Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.comok it seems you need to get the content type to post as UTF-8.
try:
Code:curl_setopt($this->curl, CURLOPT_HTTPHEADER , array( 'Content-Type: application/x-www-form-urlencoded; charset=utf-8', ));
Projects:
WCDDL - The Professional DDL Script
Top Secret Project: In Development - ZOMG
ImgTrack - Never Have Dead Images Again!
-
26th Feb 2012, 11:33 AM #4OPMemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comIf i use that i get
"Your submission could not be processed because a security token was missing"
-
26th Feb 2012, 12:53 PM #5MemberWebsite's:
sborg.us^^ Ding dong. You need to store the session ID and pass it as a parameter while making that request.
V3g3ta | Halcyon | Abhi
-
26th Feb 2012, 01:31 PM #6OPMemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comi already do that, but if am using the httpheader i get that error, if i don't use it the script is posting.
PHP Code:$url_vars = $this->array_to_http(array(
'do' => 'newthread',
'f' => $forum_id,
));
$this->curl = curl_init();
curl_setopt($this->curl,CURLOPT_URL, $this->phpbb_url . 'newthread.php?' . $url_vars );
curl_setopt($this->curl,CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl,CURLOPT_CONNECTTIMEOUT,"10");
curl_setopt($this->curl,CURLOPT_TIMEOUT,"10");
curl_setopt($this->curl, CURLOPT_HEADER, false );
curl_setopt($this->curl,CURLOPT_COOKIEFILE,$this->cookie_name );
$p= curl_exec($this->curl);
$error=curl_error($this->curl);
curl_close($this->curl);
preg_match('%name="securitytoken" value="(.*?)" />%',$p,$security123);
// Generate post string
$post_fields = array(
'sbutton' => 'Submit New Thread',
'do' => 'postthread',
'message' => $message,
'f' => $forum_id,
'securitytoken' => $security123[1],
'subject' => $topic_title,
'loggedinuser' => '1',
'wysiwyg' => 0,
'prefixid' => '',
);
$url_vars = array(
'do' => 'postthread',
'f' => $forum_id,
);
//printr($post_fields);
// Init curl
$this->curl = curl_init();
// Set options
curl_setopt ( $this->curl, CURLOPT_URL, $this->phpbb_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, 1);
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');
-
27th Feb 2012, 10:24 AM #7MemberWebsite's:
PasteBot.appspot.comcurl_setopt( $ch, CURLOPT_ENCODING, "UTF-8" );
http://www.sitepoint.com/forums/show...TF8-supporting
-
27th Feb 2012, 01:22 PM #8OPMemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comthe same
Bölüm resimleri, dizi indirme ve altyaz? linkine a?Ÿa?Ÿ?dan ula?Ÿabilirsiniz.
-
27th Feb 2012, 01:33 PM #9Respected Developer
try this
PHP Code:$message = iconv("UTF-8","Windows-1252//IGNORE",$message);
Bots Development | Web Development | Wordpress Customization | PSD Conversion
Life has many twists and turns in it, you have to take what you are given and use it for the best.
-
27th Feb 2012, 01:48 PM #10OPMemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comThe text is ok now
The only problem is that i get a notice
Code:Notice: iconv() [function.iconv]: Detected an illegal character in input string in
i read the rext from a txt file which i save it like this
Code:$fh = fopen($file,'wb'); fwrite($fh,"\xEF\xBB\xBF"); fwrite($fh,$ppost); fclose($fh);
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Selling] High quality articles and English-German-English translation
By Lendar in forum ServicesReplies: 5Last Post: 5th Jul 2012, 02:01 PM -
Where to post videobb links [need english sites]
By Rapid S in forum File Host DiscussionReplies: 0Last Post: 6th Jan 2012, 06:14 AM -
[Selling] Any Type Plugin Contect me (rapidleech, curl, php upload, Personal Site Post Plugin )
By jpavsex in forum Completed TransactionsReplies: 15Last Post: 20th Dec 2011, 03:30 AM -
Php replacing characters !
By softleaks in forum Web Development AreaReplies: 8Last Post: 30th May 2011, 02:42 PM -
Japanese Characters for Wi-Fi
By bxflow in forum General DiscussionReplies: 5Last Post: 12th Jan 2011, 01:23 AM
themaRegister - register to forums...
Version 3.46 released. Open older version (or...