2
我试图从我的服务器发送一个http请求到另一台服务器。 我发送请求的URL包含一些utf8字符,例如http://www.aparat.com/etc/api/videoBySearch/text/نوروز。php-curl dosen't在url中支持utf-8
这里是我的代码:
const api_adress = 'http://www.aparat.com/etc/api/';
const xml_config = 'http://www.aparat.com/video/video/config/videohash/[ID]/watchtype/site';
public function getDataInArray($JSON_ADRESS)
{
$json = json_decode(file_get_contents(self::api_adress . utf8_encode($JSON_ADRESS)), true);
return ($json != NULL) ? $json : die(NULL);
}
我也曾尝试PHP卷曲insted的文件-GET-的内容,但我没有答案。
的可能的复制[文件\ _get \ _contents()打破了UTF-8字符(http://stackoverflow.com/questions/2236668/file-get-contents-breaking-up-utf-8-characters) – ksno
不,它不是重复的。 – Will
我看你已经试过[utf8_encode()](http://php.net/)。该函数从ISO-8859-1转换为UTF-8,并且不能在ISO-8859-1中存储阿拉伯字符。 –