PHP: function curl($url, $post) { $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.4) Gecko/2008102920 AdCentriaIM/1.7 Firefox/3.6"); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); $result = curl_exec($ch); curl_close($ch); return $result; }; Как можно сделать, чтобы при отправке post запроса PHP: $result = curl("http://site.ru/post.php", "text=текст"); текст кодировался и отправлялся в url code PHP: $result = curl("http://site.ru/post.php", "text=%d1%82%d0%b5%d0%ba%d1%81%d1%82");
получилось только сначала из windows-1251 в utf-8 $text = iconv("windows-1251", "utf-8", $text); $text = urlencode($text);
Вопрос не стоил отдельной темы, ну а по сабжу примерно так делаю (не проверял) PHP: $res = iconv("utf-8", "windows-1251", curl("http://site.ru/post.php", "text=".urlencode(iconv("windows-1251", "utf-8",$text))));