|
|
|
| Добрый вечер, есть скрипт следующего содержания:
<?php
////////////////////////////////////////////////
$user = fopen("user.txt", "r");
$fgets_u = fgets($user);
$text = fopen("text.txt", "r");
$fgets_t = fgets($text);
////////////////////////////////////////////////
////////////////////////////////////////////////
$url = "http://example.com/includes/ajax/message.php?opt=addpost";
$postdata = "comment_message=". htmlentities(urlencode($fgets_t)) . "+&pid=" . $fgets_u;
$referer = "http://example.com/index.php";
$user_cookie_file = fopen("cookie.txt", "w");
chmod("cookie.txt", 0777);
$cookie_file = "cookie.txt";
$ip = "192.168.12.12";
////////////////////////////////////////////////
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT,
'Internet Explorer/6.0 (X11; U; Windows XP SP2; en-US; rv:1.7.2) Gecko/20040804');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: ru,en;q=0.7,de-de;q=0.3',
'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'X-Forwarded-For: ' . $ip));
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$page = curl_exec($ch);
curl_close($ch);
echo $page;
echo "<meta http-equiv=\"refresh\" content=\2; URL=http://example.ru/add_post.php\" /> ";
|
При передаче post запроса возникла проблема, кирилические символы не передаются, латинские же передаются без ошибок. В чем может быть проблема? | |
|
|
|
|
|
|
|
для: z668
(27.03.2011 в 23:54)
| | Кодировка текстовых файлов windows-1251
Заголовки сервера:
HTTP/1.1 302 Found Server: nginx Date: Sun, 27 Mar 2011 20:47:49 GMT Content-Type: text/html; charset=windows-1251 Connection: keep-alive X-Powered-By: PHP/5.1.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT | |
|
|
|
|
|
|
|
для: z668
(28.03.2011 в 00:54)
| | Вопрос снят. Кодировка скрипта приемщика UTF-8. | |
|
|
|