使用Zend Framework编码问题解析西里尔文站点

时间:2012-02-22 15:46:34

标签: zend-framework html-parsing

    $url = "http://www.kinopoisk.ru/picture/791547/";

    require_once 'Zend/Http/Client.php';
    require_once 'Zend/Dom/Query.php';

    $client = new Zend_Http_Client($url, array(
                'maxredirects' => 0,
                'timeout'      => 30,
                'useragent'    => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7'));

    $response = $client->request();
    $html = $response->getBody();

    $dom = new Zend_Dom_Query($html);

    $title = $dom->query('title');
    $titleText = $title->current()->textContent;

    echo $titleText;

// Locally returns "Постеры:  ВАЛЛ·И (WALL·E)"
// Remotely returns "Ïîñòåðû:  ÂÀËË·È (WALL·E)" 

.htaccess设置:AddDefaultCharset utf-8

远程站点中的响应标头:

Content-Encoding gzip

改变接受编码

虽然当地没有此类回复

所以我认为这是服务器故障?如何解决这个问题?

0 个答案:

没有答案