Esempio n. 1
0
 function load_html($html)
 {
     $tidy = tidy_parse_string($html);
     tidy_clean_repair($tidy);
     $html = tidy_get_html($tidy);
     phpQuery::unloadDocuments();
     return phpQuery::newDocumentHTML($html);
 }
Esempio n. 2
0
function getContent($url, $encording = 'utf8')
{
    $config = array('output-xhtml' => true, 'quote-nbsp' => false, 'indent' => false, 'wrap' => 800, 'char-encoding' => 'raw');
    $client = new Zend_Http_Client($url);
    $response = $client->request("GET");
    if ($response->isSuccessful()) {
        $html = $response->getBody();
        if ($encording != 'utf8') {
            $html = iconv("windows-1251", "utf-8", $html);
        }
        $tidy = new Tidy();
        $tidy->parseString($html, $config, 'utf8');
        $tidy = tidy_get_html($tidy);
        $thisxml = new SimpleXMLElement($tidy);
    }
    return $thisxml;
}